【发布时间】:2011-07-03 11:53:22
【问题描述】:
在我使用 struts.xml 配置我的 struts2-application 之前。但是我需要使用注释来实现新的应用程序。 对于我的动作类,我使用了这样的注释
@Namespace("/public")
@InterceptorRefs(value = { @InterceptorRef(value = "authInterceptor"), @InterceptorRef(value = "defaultStack") })
@ResultPath(value = "/")
@Result(name = "error", location = "/test/error.jsp")
在 struts.xml 中,我为拦截器类设置名称,然后在拦截器堆栈中使用它。所以我看到对于我的 Action 类,我可以设置拦截器的名称(值 =“authInterceptor”),但是我可以在哪里为我的拦截器类设置这个名称?????? 还是使用注解无法实现拦截器的配置?
【问题讨论】:
-
Я нашла где-то подсказку, что можно использовать тэг @ParentPackage, но нигде примера не нашла。
-
我和下一个人一样喜欢注解,但实际上我更喜欢通过 XML 配置 Struts2。我想我疯了。 :)
标签: struts2 annotations interceptor interceptorstack