问题
public class MyAction extends ActionSupport
{
public String getMyValue()
{
return "SomeText";
}
...
}
I have this MyAction class. Now, the question is that when I refer myValue in my JSP page using OGNL, will it create the myValue property on ValueStack, or will it just call the getter method?
回答1:
It will call a getter method. The OGNL when evaluating an expression finding a property accessor corresponding to the name of the property. It's doing it using reflection on the method basis via prefixing "get"/"set" to the name of the property.
来源:https://stackoverflow.com/questions/26752434/getter-property-without-property-and-setter-access-via-valuestack