一个跳转问题:
1.@Override
2. protected String doIntercept(ActionInvocation invocation) throws Exception {
3. OpratorInfo info=(OpratorInfo)ServletActionContext.getRequest().getSession(true).getAttribute("opratorInfo");
4. if(info!=null){
5. return invocation.invoke();
6. }else{
7. return "no";
8. }
9. } 1.<!-- 设置全局拦截器 -->
2. <interceptors>
3. <interceptor name="method-interceptor" class="com.itsp.interceptor.MethodInterceptor">
4. <param name="interceptorName">method-interceptor</param>
5. <param name="url">/ItSPWeb/error.jsp</param>
6. </interceptor>
7. <interceptor-stack name="default-with-myInterceptor">
8. <interceptor-ref name="defaultStack"></interceptor-ref>
9. <interceptor-ref name="method-interceptor"></interceptor-ref>
10. </interceptor-stack>
11. </interceptors>
12. <default-interceptor-ref name="default-with-myInterceptor"></default-interceptor-ref>
13. <!-- 设置全局的result,出现错误时跳转该页面 -->
14. <global-results>
15. <result name="no" type="redirect">/error.jsp</result>
16. </global-results> 当info为null时,return “no”,但是页面并没有发生跳转,也没有任何异常,而且doIntercept()此方法被执行2次,想知道是怎么回事?大家能帮忙解决下么?谢谢!!!
1.@Override
2. protected String doIntercept(ActionInvocation invocation) throws Exception {
3. OpratorInfo info=(OpratorInfo)ServletActionContext.getRequest().getSession(true).getAttribute("opratorInfo");
4. if(info!=null){
5. return invocation.invoke();
6. }else{
7. return "no";
8. }
9. } 1.<!-- 设置全局拦截器 -->
2. <interceptors>
3. <interceptor name="method-interceptor" class="com.itsp.interceptor.MethodInterceptor">
4. <param name="interceptorName">method-interceptor</param>
5. <param name="url">/ItSPWeb/error.jsp</param>
6. </interceptor>
7. <interceptor-stack name="default-with-myInterceptor">
8. <interceptor-ref name="defaultStack"></interceptor-ref>
9. <interceptor-ref name="method-interceptor"></interceptor-ref>
10. </interceptor-stack>
11. </interceptors>
12. <default-interceptor-ref name="default-with-myInterceptor"></default-interceptor-ref>
13. <!-- 设置全局的result,出现错误时跳转该页面 -->
14. <global-results>
15. <result name="no" type="redirect">/error.jsp</result>
16. </global-results> 当info为null时,return “no”,但是页面并没有发生跳转,也没有任何异常,而且doIntercept()此方法被执行2次,想知道是怎么回事?大家能帮忙解决下么?谢谢!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货