`
810364804
  • 浏览: 785214 次
文章分类
社区版块
存档分类
最新评论

struts中的redirect,contextRelative

 
阅读更多
1.redirect 设为true时表示执行重定向操作;当为false时,表示执行请求转发操作
注 重定向操作一般用命令:response.sendRedirect();
请求转发操作 RequestDispatcher rpath=request.getRequestDispatcher();
rpath.forward(request,response);
jsp中:<jsp:forward page="">
这两个操作的区别请楼主自己查阅资料或到csdn搜索相关主题

2.contextRelative 设为true时表示当前path属性以/开头时,给出的是相对于当前上下文的url。默认为false
================================================
1,redirect设置响应返回类型,redirect="true":重定向 缺省值为redirect="false":转发
2,如果当前路径为http://localhost/moduleA/
<forward name="..." path="/target.jsp" redirect="true" contextRelative="false"/>
执行以上forward时会转向http://localhost/moduleA/target.jsp
如contextRelative="true"时,会转向http://localhost/target.jsp

在struts1.1以上,通常使用module="/moduleA"代替

原文地址:http://blog.sina.com.cn/s/blog_65dcacbb0100hw9j.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics