【问题标题】:How can I get the Struts2 interceptor init param如何获取 Struts2 拦截器初始化参数
【发布时间】:2013-07-25 03:33:18
【问题描述】:

我在 struts.xml 中定义了一个拦截器,如下所示:

<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方法,但我不想使用这种方式,谁能告诉我该怎么做?

【问题讨论】:

  • 使用 setter 有什么问题?
  • @AleksandrM,没什么,我只是想知道是否有其他方法可以做到这一点
  • @DigengTianhan 描述一下为什么需要它,为什么不能使用bean属性?

标签: struts2


【解决方案1】:

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

casServerLoginUrl
serverName
renew
gateway

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-29
    • 2016-05-29
    • 1970-01-01
    • 2014-03-31
    • 1970-01-01
    相关资源
    最近更新 更多