建立在你的网页内容的空文件名的欢迎folder.Add follwinf进入到你的web.xml
<filter>
<filter-name>action2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>action2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
取代在web.xml中的欢迎列表文件
<welcome-file-list>
<welcome-file>welcome</welcome-file>
</welcome-file-list>
和最后在你的strus.xml中做一些类似的事情
<action name="welcome" class="welcome.action">
<result>/index.jsp</result>
</action>
我们试图做的是,当我们打到example.com
而不是显示欢迎的jsp文件,我们正在执行操作并使用其结果。在这种情况下,您的网址将保持不变,如www.mysite.com
与重定向不同,因为在所有情况下URL都是www.mysite。 COM /欢迎,但我希望它是简单的,如www.mysite.com –
@ user577691然后使用第二种机制。您也可以尝试使用JSTL include。 –
可能是我理解错误的方式,但如果我会去第二个选项的调度员仍然在我的欢迎文件列表中我必须定义动作的URL,所以我相信动作的URL会像www.mysite.com/欢迎“欢迎”将成为行动的名称。 –