2013-07-25 52 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