关于主页访问 action 的方法

关于首页访问 action 的方法都是看别人写的自己记录下①1:在你的web.xml中的Struts2的核心过滤器的映射中增

关于首页访问 action 的方法
   都是看别人写的   自己记录下


① 

1:在你的web.xml中的Struts2的核心过滤器的映射中增加
<filter-mapping>
 
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>

  <dispatcher>REQUEST</dispatcher>
  <dispatcher>FORWARD</dispatcher>

</filter-mapping>

2:把welcomelist改成你查询的action.  但是想要直接写在web.xml里面 请在webroot中新建个空白XXX.action文件
 


可以在web.xml中将默认显示页设置成任意一个,在页面中设置其自动跳转为action的地址,之后action执行之后再跳到index

把如下代码加入<head>区域中

<meta http-equiv="refresh" content="1;url=<%=request.getContextPath()%>/index.do">

注:content="1 是时间控制,表示1秒后自动跳转到要跳转的页面.
  content="0 表示打开该页后立即跳转到你要跳转的页面.
  url 是要跳转的路径