request getParameter getAttribute】的更多相关文章

在浏览器地址输入,表示传入一个参数test,值为123 http://localhost:8888/Test/index.jsp?test=123 在index.jsp中尝试使用EL表达式取出,代码如下: <body> ${test} </body> 发现毫无结果,再使用requestScope尝试取出: <body> ${requestScope.test} </body> 发现还是毫无结果,感到非常诧异,遂干脆使用java脚本尝试取出. <body…
转载自:http://www.cnblogs.com/shaohz2014/p/3804656.html 在浏览器地址输入,表示传入一个参数test,值为123 http://localhost:8888/Test/index.jsp?test=123 在index.jsp中尝试使用EL表达式取出,代码如下: <body> ${test} </body> 发现毫无结果,再使用requestScope尝试取出: <body> ${requestScope.test} &l…
(1)request.getParameter()取得是通过容器的实现来取得通过类似post,get等方式传入的数据,,request.setAttribute()和getAttribute()只是在web容器内部流转,仅仅是请求处理阶段. (2)request.getParameter()方法传递的数据,会从Web客户端传到Web服务器端,代表HTTP请求数据.request.getParameter()方法返回String类型的数据. request.setAttribute()和getAt…
HttpServletRequest类既有getAttribute()方法,也由getParameter()方法,这两个方法有以下区别: (1)HttpServletRequest类有setAttribute()方法,而没有setParameter()方法 (2)当两个Web组件之间为链接关系时,被链接的组件通过getParameter()方法来获得请求参数,例如假定welcome.jsp和authenticate.jsp之间为链接关系,welcome.jsp中有以下代码: <a href=&quo…
这里就request为例,不去考虑session. request对象是javax.servlet.http.HttpServletRequest接口的一个实例,request表示调用JSP页面的请求,如request.getParameter("paramName")表示获得Form提交过来的参数. request.getParameter()返回的是Web客户端向Web服务器端传送数据. HttpServletRequest类没有setParameter()方法,request.g…
getAttribute表示从request范围取得设置的属性,必须要先setAttribute设置属性,才能通过getAttribute来取得,设置与取得的为Object对象类型 getParameter表示接收参数,参数为页面提交的参数,包括:表单提交的参数.URL重写(就是xxx?id=1中的id)传的参数等,因此这个并没有设置参数的方法(没有setParameter),而且接收参数返回的不是Object,而是String类型 HttpServletRequest类既有getAttribu…
request.getAttribute():是request时设置的变量的值,用request.setAttribute("name","您自己的值");来设置值, request.getParameter():提取发送过来的參数如:本网页 request.getParameter 是用来接受来自get方法或post方法的參数 <form method=post> <form method=get> <a href="1.j…
1.session.setAttribute()和session.getAttribute()配对使用,作用域是整个会话期间,在所有的页面都使用这些数据的时候使用. 2.request.setAttribute()和request.getAttribute()配对使用,作用域是请求和被请求页面之间.request.setAttribute()是只在此action的下一个forward需要使用的时候使用:request.getAttribute()表示从request范围取得设置的属性,必须要先s…
getParameter 是用来接受用post个get方法传递过来的参数的.getAttribute 必须先setAttribute.(1)request.getParameter() 取得是通过容器的实现来取得通过类似post,get等方式传入的数据,request.setAttribute()和getAttribute()只是在web容器内部流转,仅仅是请求处理阶段.(2)request.getParameter() 方法传递的数据,会从Web客户端传到Web服务器端,代表HTTP请求数据.…
HttpServletRequest类既有getAttribute()方法,也有getParameter()方法,这两个方法有以下区别:1.HttpServletRequest类有setAttribute()方法,而没有setParameter()方法:2.当两个Web组件之间为链接关系时,被链接的组件通过getParameter()方法来获得请求参数: 例如,假定welcome.jsp和authenticate.jsp之间为链接关系,welcome.jsp中有以下代码:代码如下: <a hre…