首页跳转方式解决
程序员文章站
2024-01-02 21:17:10
...
网站首页跳转时候,需要不显示具体的路径,此时就需要再index.jsp里配置下跳转,可以使用jsp:forward标签即可,但是有时候却会配置好了,却会显示404的错误。此时需要再web.xml里加上:<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
这两行必须要加上才行。
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<dispatcher>FORWARD</dispatcher>
这两行必须要加上才行。
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>