[英]invoke javax.el.MethodExpression from jsf component
I have a jsp tag which takes a javax.el.MethodExpression as attribute:我有一个 jsp 标签,它采用 javax.el.MethodExpression 作为属性:
<%@ attribute name="action" required="true" type="javax.el.MethodExpression" rtexprvalue="true" %>
within the same tag I have:在我有的同一个标签中:
<h:commandLink action="#{action}">
link text
</h:commandLink>
I'm getting the following error when I try to click the link:当我尝试单击链接时出现以下错误:
javax.faces.FacesException: #{action}: org.apache.jasper.el.JspMethodNotFoundException: /WEB-INF/tags/pager/pager.tag(17,1) '#{action}' Identity 'action' was null and was unable to invoke
is it possible for the commandLink to properly invoke the "action" method? commandLink 是否可以正确调用“action”方法?
It's been a while since I did JSF, but I'm pretty sure a method expression is of the form: #{bean.method}
.自从我使用 JSF 已经有一段时间了,但我很确定方法表达式的形式是:
#{bean.method}
。 You can't just say #{method}
.你不能只说
#{method}
。
Don't create a JSP tag.不要创建 JSP 标记。 Create a JSF component.
创建一个 JSF 组件。 Extend
UIComponentELTag
.扩展
UIComponentELTag
。 Tutorials here . 教程在这里。
Or, if you're using Facelets, consider a template using ui:composition
.或者,如果您使用的是 Facelets,请考虑使用
ui:composition
的 模板。 Tutorials here .教程在这里。
Or, if you're already on JSF 2.0, you can get a step further with composite components .或者,如果您已经使用 JSF 2.0,则可以使用复合组件更进一步。 Tutorial here .
教程在这里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.