struts2指定欢迎 页面为action请求
文章地址:http://xinghaifeng2006.javaeye.com/blog/726956
方法一:在index.jsp中用forward跳转执行action
步骤
第一步:
web.xml中修改
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern >/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
第 二步:
web.xml中添加
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
第 三步:
首页跳转语句
index.jsp内容如下:
<jsp:forward page="/max/HelloWorld.action"></jsp:forward>
方法二:在index.html中使用META重定向。
操作:<META HTTP-EQUIV="Refresh" CONTENT="0;URL=max/HelloWorld.action">
其中,
content="1 是时间控制,表示1秒后自动跳转到要跳转的页面.
content="0 表示打开该页后立即跳转到你要跳转的页面.
url 是要跳转的路径
本文介绍两种方法实现 Struts2 框架中将欢迎页面设置为 Action 请求:一是通过 JSP 的 forward 跳转,二是使用 HTML 的 META 标签进行重定向。
&spm=1001.2101.3001.5002&articleId=5946436&d=1&t=3&u=75146ba644f7481fafef62aed48bf2bb)
61

被折叠的 条评论
为什么被折叠?



