工程中用到了struts2,index.jsp中使用jsp:forward命令跳转来执行action,web.xml中需要做如下配置:

<filter-mapping>
 <filter-name>struts2</filter-name>
 <url-pattern>/*</url-pattern>
 <dispatcher>REQUEST</dispatcher>
 <dispatcher>FORWARD</dispatcher>
 </filter-mapping>

不明白为什么要这样配置,有时间好好研究一下。如果觉得配置web.xml很麻烦,不如使用jstl的redirect标签来跳转,可以达到一样的效果。

<c:redirect url="/login.action"></c:redirect>

  5 Responses to “struts2中使用jsp:forward命令”

  1. 朋友推荐过来的…文章有深度.

  2. 有时间常来看看啊,博客不旬!

  3. 纯代码文章

  4. 额,文章就是代码,代码就是文章

  5. 我的博客也不错 嘿嘿 就是没人看。没什么说的,我都感觉自己写的内容都在老调重弹。还是你的www.ooobj.com犀利点…

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 一起去看海 Suffusion theme by Sayontan Sinha