java - 从 jsf 组件调用 javax.el.MethodExpression

标签 java jsf jstl method-invocation

我有一个 jsp 标记,它采用 javax.el.MethodExpression 作为属性:

<%@ attribute name="action" required="true" type="javax.el.MethodExpression" rtexprvalue="true" %>

在我拥有的同一标签内:

<h:commandLink action="#{action}">
    link text
</h:commandLink>

当我尝试单击该链接时收到以下错误:

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

commandLink 是否可以正确调用“action”方法?

最佳答案

不要创建 JSP 标记。创建一个 JSF 组件。延长UIComponentELTagTutorials here .

或者,如果您使用 Facelets,请考虑 template使用ui:compositionTutorials here

或者,如果您已经使用 JSF 2.0,则可以使用 composite components 更进一步。 。 Tutorial here .

关于java - 从 jsf 组件调用 javax.el.MethodExpression,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2547779/

相关文章:

java - WS动态客户端和complexType参数

选择多行进行排序时发生 JavaFX TreeTableView 异常

Java线程似乎无法正常运行

java - 是否可以在JSP中访问方法注释

html - 使用 EL 访问对象属性时进行 null 检查的必要性

java - 使用 c 时如何将 cookie 传递给资源 :import?

java - 高效的自然语言数据结构、持久化和查询

java - 数据库中的 primefaces 图形图像未加载

jsf - 具有默认方法 JSF 的接口(interface)中的 Getter

html - 如何改变h :inputText control inside a rich:Panel的背景颜色