当部署一个web项目的过程中,如果在<welcome-file-list>中配置如下的代码
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
这样,访问网址http://localhost:8080/test时可以跳转到index.jsp页面
如果我创建一个Action,在struts.xml中配置一个访问wel.do访问路径,跳转到Action类中的excute方法中
,执行这里面的return mapping.findForward("index");然后修改<welcome-file>节点内容为wel.do则再次访问的
时候就会报404错误
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
这样,访问网址http://localhost:8080/test时可以跳转到index.jsp页面
如果我创建一个Action,在struts.xml中配置一个访问wel.do访问路径,跳转到Action类中的excute方法中
,执行这里面的return mapping.findForward("index");然后修改<welcome-file>节点内容为wel.do则再次访问的
时候就会报404错误
<welcome-file>index.jsp </welcome-file>
</welcome-file-list> index.jsp
<body onload="javascript:window.location='wel.do';">这样,访问 http://localhost:8080/test 就相当于 自动请求了 wel.do
pageEncoding="utf-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="refresh" content="0; url=wel.do">
</head>
</html>
直接在首页上做一个简单的Action跳转就可以了。
就是在web.xml文件中,配置一个.do的文件,通过它直接跳转到系统的首页. <welcome-file-list>
<welcome-file>index.do</welcome-file>
</welcome-file-list>建立index.do的空文件.在struts_config.xml文件配置:
<action path="/index" type="org.apache.struts.actions.ForwardAction" parameter="/login.jsp" >
就可以通过index.do访问login.jsp文件了,呵呵!!