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 是要跳转的路径

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值