How to call an action method using OGNL

心已入冬 提交于 2019-12-08 20:04:39

This quote() method is not called. I am using xwork-2.0.1.jar and ognl-2.6.11.jar.

You don't have that method in your action. If you create it:

public String quote() {

and use normal OGNL method call syntax:

<s:property value="%{quote()}" />

then it will be called as desired.

Your original syntax is almost correct–just leave off the parens.

<s:property value="%{quote}" />

JavaBean contentions are more general-purpose than explicit method invocation, e.g., use JSP EL:

${quote}

JavaBean conventions are be preferred when the function takes no arguments.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!