首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

怎么将tomcat默认首页直接访问action

2013-01-11 
如何将tomcat默认首页直接访问action本帖最后由 hyqinger 于 2012-12-29 20:24:01 编辑因为首页有一些数据

如何将tomcat默认首页直接访问action
本帖最后由 hyqinger 于 2012-12-29 20:24:01 编辑 因为首页有一些数据需要显示。所以希望默认首页能够先访问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呢。
[解决办法]
如果你想打开的默认路径http://localhost:8080/ui/  那么你可以tomcat conf\Catalina\localhost路径下,新建一个xml文件,把下面的代码粘贴上,文件名ui.xml

<?xml version='1.0' encoding='utf-8'?>
<Context workDir="work\Catalina\localhost\ui" path="/ui" docBase="项目ui本地路径" useNaming="false" reloadable="true">
</Context>


ps:ui就是你默认想直接登录的页面。

热点排行