日期:2014-05-20 浏览次数:20695 次
package test; public interface LoginAction { public void execute(); }
------解决方案--------------------
这个可以直接用struts2的拦截器,我是这么用的:
struts.xml
<struts> <package name="authority-default" extends="struts-default"> <interceptors> <interceptor class="com.lan.baseproject.interceptor.AuthorityInterceptor" name="authority"/> <interceptor-stack name="mydefault"> <interceptor-ref name="defaultStack"></interceptor-ref> <interceptor-ref name="authority"></interceptor-ref> </interceptor-stack> </interceptors> <default-interceptor-ref name="mydefault"/> <global-results> <result name="login" type="redirect">/login.jsp</result> </global-results> </package> </struts>
------解决方案--------------------
我都是这么写:
<bean id="clientInter" class="cn.qdrk.strive.crm.interceptor.ClientInterceptor" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> </bean> <bean id="clientInfor" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" abstract="false" lazy-init="default" autowire="default" dependency-check="default"> <property name="beanNames"> <list> <value>/undoBusiness</value> <value>/crminit</value> <value>/businesslist</value> <value>/cruxset</value> <value>/messagelist</value> </list> </property> <property name="interceptorNames"> <list> <value>clientInter</value> </list> </property> </bean>
------解决方案--------------------
用filter校验session
------解决方案--------------------
2楼的struts2拦截器都用上了~~楼主说spring,呵呵
如此配置:
<bean id="serv" class="acpectJ.ServiceImp" /> //老话题:实例的bean <bean id="aop" class="acpectJ.AopTest2" /> //老话题:切面类 <aop:config proxy-target-class="true"> //与自动加载的<aop:aspectj-autoproxy />的proxy-target-class功能一样.,设置代理类型:jdk/GBlib <aop:aspect ref="aop"> //很明显,aspect是切面的意思,你说人家要的的什么,这个也问,白痴啊~ <aop:before pointcut="execution(* add())" method="testAfterReturning" /> //pointcut,切点的意思,人家要的当然是切点表达式, //method,方法,要执行这个切点的方法,是哪个,记住我说的是切面类的方法;如果所有方法execution(* *()); </aop:aspect> </aop:config>