【问题标题】:Getter Property (without property and setter) Access Via ValueStackGetter 属性(没有属性和 setter)通过 ValueStack 访问
【发布时间】:2014-11-05 08:16:38
【问题描述】:
public class MyAction extends ActionSupport
{
     public String getMyValue()
     {
          return "SomeText";
     }
     ...
}

我有这个MyAction 课程。现在,问题是当我在我的 JSP 页面中使用 OGNL 引用 myValue 时,它会在 ValueStack 上创建 myValue 属性,还是只调用 getter 方法?

【问题讨论】:

    标签: java jsp struts2 ognl valuestack


    【解决方案1】:

    它会调用一个getter方法。评估与属性名称对应的属性访问器的表达式时的 OGNL。它是通过在属性名称前加上 "get"/"set" 来使用基于方法的反射来实现的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-25
      • 2017-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-27
      相关资源
      最近更新 更多