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

关于struts2 页面选择解决思路

2012-03-14 
关于struts2 页面选择各位大侠们好:偶是一个菜鸟级人物,想问这样一个问题,大家都知道,web开发最重要配置we

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

[解决办法]
解决办法,设置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> 


[解决办法]
最简单办法:
1.web.xml
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list

2.index.jsp
<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<meta http-equiv='refresh' content='0;url=请求名'>

热点排行