当部署一个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错误

解决方案 »

  1.   

    很简单,在web根目录创建一个名字为wel.do的空文件就可以了。
      

  2.   

    <welcome-file>index.jsp </welcome-file> 些节点中只能包含HTML、HTM、TEXT文件,不能访问控制器
      

  3.   

    要实现 该功能,可以这样做:<welcome-file-list> 
      <welcome-file>index.jsp </welcome-file> 
    </welcome-file-list> index.jsp
    <body onload="javascript:window.location='wel.do';">这样,访问 http://localhost:8080/test 就相当于 自动请求了 wel.do
      

  4.   

    index.jsp<%@page language="java" contentType="text/html; charset=utf-8"
    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>
      

  5.   

    不能访问Action,再做一个中间介质吧
      

  6.   

    为什么你要跳转到一个.do页面啊,用户第一次登陆你就需要进行什么处理吗?又没有进行交互还是说你要判断用户的ip?如果是全局性质的逻辑操作可以使用过滤器进行操作的。
      

  7.   

    <welcome-file-list> 中不能配置需路径,这里要配置一个确实存在的页面文件!
      

  8.   

    楼主可参考 3 、4楼的建议!
    直接在首页上做一个简单的Action跳转就可以了。
      

  9.   

    建立一个jsp页面,直接跳转到action中。
      

  10.   

    其实我的想法很简单:
    就是在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文件了,呵呵!!