日期:2014-05-17  浏览次数:20699 次

struts2 在页面自动跳转到一个action
错误:
Struts has detected an unhandled exception: 

Messages: com.meishi.action.indexAction 
Unable to instantiate Action, com.meishi.action.indexAction, defined for 'index' in namespace '/back'com.meishi.action.indexAction 





页面:
<SCRIPT type="text/javascript">
setTimeout("loady()", 3000);
function loady(){
window.location='index.action';
}
</SCRIPT>

 </head>
  
  <body>
  成功登陆!!3秒后为你自动跳转<br/>
  如果页面没有自动加载,请
  <a href="index.action">单击这里</a>
  </body>


问题是:登录成功后,也跳转到了这个页面,3秒后跳转时出错了。
主要是地址栏多了一个namespace:
http://localhost:8080/meishi_final/back/index.action

正确地址应该是
http://localhost:8080/meishi_final/index.action


------解决方案--------------------
window.location='../index.action';