2013年12月16日星期一

Interceptor does not work

struts2.xml





$ {result}
$ {result}
$ {result}
$ {result}
$ {result}







/ index.jsp



class

public class RegisterInterceptor extends AbstractInterceptor {

@ Override
public String intercept (ActionInvocation ai) throws Exception {
UserAction userAction = (UserAction) ai.getAction ();
System.out.println (userAction.getUser () getName ().);
return Action.SUCCESS;
}

}
I opened the debugger hit a breakpoint or not come
------ Solution ------------------------- -------------------
landlord above you
Here you know interceptor is com.accp.dao.util.GenericDaoSupport this class is not your RegisterInterceptor this class
------ Solution ---------- ----------------------------------
interceptor configuration should the landlord is not very clear
give you an example paragraph

<interceptors>
<interceptor name="autherInterceptor" class="com.dev.web.interceptor.AutherInterceptor"/>
<interceptor-stack name="customeStack">
<!--自定义拦截器-->
<interceptor-ref name="autherInterceptor"/>
<!--默认的拦截器-->
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="customeStack" />

------ For reference only ----------------------------------- ----
with only this one a try !
------ For reference only -------------------------------------- -
thank you enthusiastic answer .3 L really careful I did not pay attention to

没有评论:

发表评论