20.OGNL与ValueStack(VS)-普通方法访问

转自:https://wenku.baidu.com/view/84fa86ae360cba1aa911da02.html

首先在User中增加一个成员方法,代码如下:
public String get(){

              return "这是User中的get方法";

}
在LoginAction中也有类似的get方法,随后再在loginSuc.jsp中增加如下代码:
调用值栈对象中的普通方法(2):<s:property value="user.username.length()"/><br>

调用值栈对象中的普通方法(1):<s:property value="user.get()"/><br>

调用LoginAction中的普通方法:<s:property value="get()"/><br>
最后测试,发现这些方法都可以访问到。

原文地址:https://www.cnblogs.com/sharpest/p/5582860.html