关于在web中的数据传递
2017-07-02 21:35
183 查看
1、Parameter
getParameter():只要请求中携带了参数(get/post方式都可以),携带参数的方式:
(1) 请求地址后面?field1=xx&fileld2=xx(form表单提交如果get方式也属于)
(2) <jsp:forward>中携带
(3) 在httprequest头中form-data(post)在httprequest头中form-data(post)
在JSP中使用request.getParameter()或者${param.name}
在Servlet中使用request.getParameter()
2、Attribute
request.setAttribute(name, object):在服务器中设置属性值,跟客户端没有关系。
发生在Servlet中通过setAttribute(),在JSP中getAttribute(EL和JSTL)获取值进行显示。
如果在Servlet定义了setAttribute,是否可以通过response.sendRedirect(url)跳转到某个JSP,再在此JSP中通过getAttribute获取值吗?NO
getParameter():只要请求中携带了参数(get/post方式都可以),携带参数的方式:
(1) 请求地址后面?field1=xx&fileld2=xx(form表单提交如果get方式也属于)
(2) <jsp:forward>中携带
(3) 在httprequest头中form-data(post)在httprequest头中form-data(post)
在JSP中使用request.getParameter()或者${param.name}
在Servlet中使用request.getParameter()
2、Attribute
request.setAttribute(name, object):在服务器中设置属性值,跟客户端没有关系。
发生在Servlet中通过setAttribute(),在JSP中getAttribute(EL和JSTL)获取值进行显示。
如果在Servlet定义了setAttribute,是否可以通过response.sendRedirect(url)跳转到某个JSP,再在此JSP中通过getAttribute获取值吗?NO
相关文章推荐
- 关于在web中的数据传递
- 浅谈ASP中Web页面间的数据传递
- 浅谈ASP中Web页面间的数据传递
- 浅谈ASP中Web页面间的数据传递
- [转]用 WebDAV 通过 Web 传递 XML 数据
- web开发中的分层原则和各层之间的数据传递问题
- 使用SoapHeader传递Web Serivices自定义的身份验证数据
- 关于Action(extends HttpServlet)与JSP间数据传递总结
- 使用SoapHeader传递Web Serivices自定义的身份验证数据
- 浅谈ASP中Web页面间的数据传递
- Flex(ActionScript3)+XML+PHP+MySQL的Web框架的数据传递
- 浅谈ASP中Web页面间的数据传递
- C++ Builder 6 BizSnap/SOAP/WebService(2) -- 通过 SOAP 传递自定义类型数据(改)
- Web程序中网页间数据传递方法小结
- 在ASP.NET这实现Web页面间数据传递的方法
- 浅谈ASP中Web页面间的数据传递
- Web程序中网页间数据传递方法小结
- ASP中Web页面间的数据传递方式
- ASP.NET页面间数据传递小结,浅谈ASP中Web页面间的数据传递
- Flex(ActionScript3)+JSON+PHP+MySQL的Web框架的数据传递