你可以把数据放到一个bean中,然后用request传递过去,代码如下:
....
把数据放到myBean中然后用:
String strUrl=request.getParameter("openUrl");
request.setAttribute("属性的名字",myBean);
RequestDispatcher dispatcher = request.getRequestDispatcher(strUrl);
dispatcher.forward(request, response);然后要打开的JSP页面中用:
mybean=request.getAttribute("属性的名字");
后就可以得到bean,然后就可以操作数据了。
....
把数据放到myBean中然后用:
String strUrl=request.getParameter("openUrl");
request.setAttribute("属性的名字",myBean);
RequestDispatcher dispatcher = request.getRequestDispatcher(strUrl);
dispatcher.forward(request, response);然后要打开的JSP页面中用:
mybean=request.getAttribute("属性的名字");
后就可以得到bean,然后就可以操作数据了。
解决方案 »
- HttpClient4.0框架进行压力测试问题
- this id generator generates long, integer, short 错误
- 部署后jsp中获得浏览器信息为空
- MySQL转MSSQL问题
- c3p0 问题,在线等!!!!加急~~~~~
- 问两个问题
- svn提交错误问题
- 这句话什么意思?关于<jsp:include page="xx" flush="xx"/>
- 向大神门求助,用MVC做的婚纱摄影网站,JSP+Struts2+Spring,获取数据库信息时候获取不到
- 请问一下这个pom.xml在哪里?
- eclipse怎么编译javabean?
- 请问在jsp中confirm命令如何使用? 着急在线等
ServletContext.setAttribute()
jsp:
ServletContext.getAttribute()
原为:
String strUrl=request.getParameter("openUrl");
改为:
String strUrl="openUrl"; //要打开的JSP页面的URL。
也可以用
<jsp:useBean id="" class="" scope="request" />来在页面引入bean
而后用<jsp:getProperty/>来获得值
原句为:
String strUrl=request.getParameter("openUrl");
改为:
String strUrl="openUrl"; //要打开的JSP页面。