Java Struts2示例/HelloWorld.action

Java Struts2示例/HelloWorld.action,java,struts2,Java,Struts2,我正在尝试将html/jsp设置为我的索引页。我在struts.xml中设置了home.html。当我加载“localhost/appName/”时,它会加载home.html,但它的url是“localhost/appName/example/HelloWorld.action”。有没有办法让它在结尾显示home.html 这是我的struts.xml /error.jsp /home.html 要实现这一点,您可以在web.xml文件中配置索引页。在web.xml <web-

我正在尝试将html/jsp设置为我的索引页。我在struts.xml中设置了home.html。当我加载“localhost/appName/”时,它会加载home.html,但它的url是“localhost/appName/example/HelloWorld.action”。有没有办法让它在结尾显示home.html

这是我的struts.xml


/error.jsp
/home.html

要实现这一点,您可以在
web.xml
文件中配置索引页。在
web.xml

<web-app> 
  <welcome-file-list>
    <welcome-file>
        home.html
    </welcome-file>
  </welcome-file-list>
<!-- your other configurations-->
</web-app>

home.html

不要直接访问页面。
<web-app> 
  <welcome-file-list>
    <welcome-file>
        home.html
    </welcome-file>
  </welcome-file-list>
<!-- your other configurations-->
</web-app>