[英]Struts2 Example/HelloWorld.action
I'm trying to set an html/jsp as my index page. 我正在尝试将html / jsp设置为我的索引页面。 I've set a home.html in the struts.xml.
我在struts.xml中设置了home.html。 When I load the "localhost/appName/" , it loads the home.html but it has "localhost/appName/example/HelloWorld.action" as the url.
当我加载“ localhost / appName /”时,它加载了home.html,但它的URL为“ localhost / appName / example / HelloWorld.action”。 Is there anyways to get it to just show the home.html at the end?
反正有没有让它只是在最后显示home.html?
Here is my struts.xml 这是我的struts.xml
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index" />
<global-results>
<result name="error">/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="error"/>
</global-exception-mappings>
<action name="index">
<result>/home.html</result>
</action>
</package>
<!-- <include file="example.xml"/> -->
<!-- Add packages here -->
To achieve this you can configure your Index page in web.xml
file. 为此,您可以在
web.xml
文件中配置索引页面。 Include following configurations in web.xml
在
web.xml
包括以下配置
<web-app>
<welcome-file-list>
<welcome-file>
home.html
</welcome-file>
</welcome-file-list>
<!-- your other configurations-->
</web-app>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.