如何将tomcat默认首页直接访问action

见鬼 2012-12-29 08:23:23
因为首页有一些数据需要显示。所以希望默认首页能够先访问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呢。
...全文
520 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
小林望北 2013-05-22
  • 打赏
  • 举报
回复
引用 7 楼 SuperMan1022 的回复:
web.xml里面设置一个默认打开页面init.jsp,再在init.jsp页面里面初始自动加载index.action <meta http-equiv="refresh" content="0;url=index.action">
不懂<meta http-equiv="refresh" content="0;url=index.action">加在哪里
suciver 2012-12-31
  • 打赏
  • 举报
回复
引用 7 楼 SuperMan1022 的回复:
web.xml里面设置一个默认打开页面init.jsp,再在init.jsp页面里面初始自动加载index.action <meta http-equiv="refresh" content="0;url=index.action">
+1
  • 打赏
  • 举报
回复
web.xml里面设置一个默认打开页面init.jsp,再在init.jsp页面里面初始自动加载index.action <meta http-equiv="refresh" content="0;url=index.action">
kyolxs 2012-12-31
  • 打赏
  • 举报
回复
consuy 2012-12-30
  • 打赏
  • 举报
回复
脚本中是检验是否有数据,没有的话就请求,重新加载下
consuy 2012-12-30
  • 打赏
  • 举报
回复
我又个很简单的方法

<body>
  	<form action="_userlist.do" method="post" id="pageForm"></form>
  	<center>
	  	<table height="100%" align="center">
	  		<tr>
	  			<td valign="middle"><img alt="Please waiting...." src='images/loading.gif' border='0'id="singlePhoto" />Please waiting ...</td>
	  		</tr>
	  	</table>
    </center>
  </body>
  <script type="text/javascript">
	$.post("_checkSession.do",function(data){
		if (data != null)
		{
			document.getElementById("pageForm").submit();
		}
			
	});
  </script>
wsyangzuda 2012-12-29
  • 打赏
  • 举报
回复
这是我在公司用到的技术,不知道合适ssh吗,希望对你有参考价值
wsyangzuda 2012-12-29
  • 打赏
  • 举报
回复
如果你想打开的默认路径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就是你默认想直接登录的页面。
喵主子 2012-12-29
  • 打赏
  • 举报
回复
action包路径不是“/”吧?

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧