因为首页有一些数据需要显示。所以希望默认首页能够先访问action
这是web.xml 的设置。
<welcome-file-list>
<welcome-file>index.action</welcome-file>
</welcome-file-list>
这是struts.xml
<action name="index" class="cn.action.Index" method="main">
<result name="index">/index.jsp</result>
</action>
直接访问http://localhost:8080/项目名称
会报404错误。有没有能够不通过jsp重定向的方式直接先访问action呢。
<?xml version='1.0' encoding='utf-8'?>
<Context workDir="work\Catalina\localhost\ui" path="/ui" docBase="项目ui本地路径" useNaming="false" reloadable="true">
</Context>
ps:ui就是你默认想直接登录的页面。