2013-07-25 24 views
2

我在struts.xml中定义了一个拦截器是这样的:我如何获得Struts2的拦截器初始参数

<interceptor name="ssoAuthenticationInterceptor" class="net.ysccc.sso.authentication.AuthenticationInterceptor"> 
      <param name="casServerLoginUrl">http://localhost:8080/cas/login</param> 
      <param name="serverName">http://localhost:8080</param> 
      <param name="renew">false</param> 
      <param name="gateway">false</param> 
     </interceptor> 
现在

在拦截器类我想获得帕拉姆,有一种方法是定义的getter setter方法在该班,但我不想用这种方式,谁能告诉我该怎么办?

+2

使用setter有什么问题? –

+0

@AleksandrM,没什么,我只想知道是否有另一种方式来做到这一点 –

+0

@DigengTianhan描述你为什么需要它,为什么你不能使用bean的属性? –

回答

0

对所有参数使用Getters和Setters,属性必须在Interceptor中公开。

casServerLoginUrl 
serverName 
renew 
gateway