当用户访问WebApp的根目录时,如何自动触发struts2中的操作



i构建简单的Web应用程序StrutsCrud。要访问其欢迎页面,用户可以输入:

http://localhost:8080/StrutsCrud/

我想在用户键入此类URL时自动触发操作。

那么,如何将Struts Action分配为struts.xml中的撑杆动作(WebApp的根)?

谢谢!

没有简单的方法在支撑杆中进行操作。 Follow this procedure, it works without an issue and mostly it's the standard way

web.xml

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

和in index.jsp

<jsp:forward page="/yourDefault.action" />

最新更新