当前位置: 代码迷 >> Java Web开发 >> strust2 进去指定的action方法之后没有返回指定的页面
  详细解决方案

strust2 进去指定的action方法之后没有返回指定的页面

热度:562   发布时间:2016-04-16 21:26:45.0
strust2 进入指定的action方法之后没有返回指定的页面
strust2 进入指定的action方法之后没有返回指定的页面

action方法:
public String getdeptinfo(){
System.out.println("1111111111");
ActionContext context=ActionContext.getContext();
UserBiz biz=new UserBizImpl();
List<Dept> list=biz.getdeptinfo();
context.put("dept_list", list);
return "success";
}


strust.xml配置
<action name="usermanagement" method="getdeptinfo" class="action.LoginAction">
      <result name="success">/user.jsp</result>
     </action>



jsp页面:
<a href="usermanagement!getdeptinfo.do">添加用户</a>


在线等解释,还有就是我把return ”success“换成人return别的,配置的result跟着改会报错,比如改成return “ok”.页面报错如下:
------解决思路----------------------
把这个方法换个其它的名字
public String getdeptinfo(){
    System.out.println("1111111111");
    ActionContext context=ActionContext.getContext();
    UserBiz biz=new UserBizImpl();
    List<Dept> list=biz.getdeptinfo();
    context.put("dept_list", list);
    return "success";
}

比如test试试
------解决思路----------------------
//不知道你的web.xml配置,试试这个:
<a href="usermanagement!getdeptinfo.action">添加用户</a>

------解决思路----------------------
这种问题很好解决的
首先在你的getdeptinfo方法中加个断点,看看能不能走到你的方法里
如果没问题的话,你再看看配置文件里的jsp路径是否正确!!
------解决思路----------------------
有时候会犯病   不管他  明天可能就好了
------解决思路----------------------
是不是jar包出问题了!其他页面不会?单单这个页面?
  相关解决方案