关于struts2 页面选择

yzq8888 2011-05-31 10:12:16
各位大侠们好:
偶是一个菜鸟级人物,想问这样一个问题,大家都知道,web开发最重要配置web.xml,在里面可以写welcome.jsp.但现在有个需求,我不要走welcome.jsp页面,我想web初始化,直接走action,获取数据,之后跳转到指定jsp,如何实现?
...全文
98 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
redlotus_lyn 2011-06-01
  • 打赏
  • 举报
回复
最简单办法:
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=请求名'>
yzq8888 2011-06-01
  • 打赏
  • 举报
回复
thanks,I'll try
阿甘1976 2011-05-31
  • 打赏
  • 举报
回复
解决办法,设置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>

81,094

社区成员

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

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