request.getAttribute() 指的是获取上个请求内的 setAttribute 的属性,作用域是单次的请求,而且只限于服务端。 从客户端的请求是无法获取到任何值的,因为客户端只是html 页面。
request.Parameter() 是获取客服端传递过来的属性,如页面的input属性 等。
另外有种情况,想在客户端保留request的 setAttribute 的属性 ,可以采用在服务端生成html 页面是 ,通过隐藏域的方式带到页面。
<input type = "hidden" name ="" value = "<%=request.getAttribute("xxx")%>"/>
之后可以在该页面再次提交时,在服务端通过 request.Parameter("xxx") 获取到该属性。