读书人

struts2指定欢迎页面替action请求

发布时间: 2012-11-21 08:23:26 作者: rapoo

struts2指定欢迎页面为action请求

方法一:在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 是要跳转的路径

?

读书人网 >软件架构设计

热点推荐