在servlet的doPost()中写:
this.getServletConfig().getServletContext().getRequestDispatcher
(anotherjsp).forward(request,response);
request,response是doPost()的参数,会带给你要去的jsp页面
anotherjsp是你要去的jsp页面,以/开头,这个/不是指http://hostname/,而是根据你在服务器配置中的context而定。例如在tomcat 3.2的server.xml里,如果你添加了一个context,path="/yourapp",则这个/就表示http://hostname/yourapp/
this.getServletConfig().getServletContext().getRequestDispatcher
(anotherjsp).forward(request,response);
request,response是doPost()的参数,会带给你要去的jsp页面
anotherjsp是你要去的jsp页面,以/开头,这个/不是指http://hostname/,而是根据你在服务器配置中的context而定。例如在tomcat 3.2的server.xml里,如果你添加了一个context,path="/yourapp",则这个/就表示http://hostname/yourapp/
解决方案 »
- JSP页面include 引起的ACTION多次加载
- 有关java.lang.NoClassDefFoundError问题
- struts2 s:checkbox标签格式问题
- 对预编译的sql语句凝问?
- 求救:后台java解析xml文件把数据显示在jsp页面,如何对循环表单修改和增加???
- 关于jprofiler在unix中连接问题
- 页面如何返回提示信息
- 怎样通过js传值呢?
- 求助J2SE UDP聊天程序
- tomcat 热部署war文件
- 在jb6里面一个jsp工程,本来好好,今天一来,编译变成了vfs://host:0/file:///F:/MobileFrameJSP/defaultroot/MainJsp.jsp
- 怎样配置开发JSP的环境?小弟求知心切,请各位高手指教!谢谢!谢谢!
则在servlet中,
String value = request.getParameter("namel");
request.setAttribute("name1",value);
RequestDispatcher rd= request.getRequestDispatcher(url);//url为jsp路经,
rd.forward(req, res);在jsp中,
<%
String value = request.getAtrtribute("namel");
%>
that's ok .