各位大侠们好:
 偶是一个菜鸟级人物,想问这样一个问题,大家都知道,web开发最重要配置web.xml,在里面可以写welcome.jsp.但现在有个需求,我不要走welcome.jsp页面,我想web初始化,直接走action,获取数据,之后跳转到指定jsp,如何实现?

解决方案 »

  1.   

    解决办法,设置index.jsp等,在这个里面通过url跳转或struts2的action标签跳转到你的action的地址就可以了,web.xml中这样配置 
    <welcome-file-list> 
      <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 然后在index.jsp中使用Struts2的标签 
    <s:action name="getDataInfo" executeResult="true"></s:action> 
      

  2.   

    最简单办法:
    1.web.xml
    <welcome-file-list>  
      <welcome-file>index.jsp</welcome-file>  
    </welcome-file-list2.index.jsp
    <%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%><meta http-equiv='refresh' content='0;url=请求名'>