需要注意的是,action需要先被调用到,OGNL才能成功,因为action被执行才被压入值栈
package com.wolfgang.action; import com.opensymphony.xwork2.ActionSupport; public class TestOGNL extends ActionSupport{
private String name="jeff"; public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public String TestActionFuc()
{
return "success";
}
}
<action name="testOGNL" class="com.wolfgang.action.TestOGNL">
<result>/OGNL/static.jsp</result>
</action>
action方法
属性:<s:property value="getName()"/>
方法:<s:property value="TestActionFuc()"/>