javax.el.PropertyNotFoundException与CompositeComponent吗? [英] javax.el.PropertyNotFoundException with CompositeComponent?

查看:105
本文介绍了javax.el.PropertyNotFoundException与CompositeComponent吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试构建复合组件,这就是我利用组件的方式:

I'm currently trying to build a composite component, and this is how i make use of my component :

将其包含在xmlns:albert="http://java.sun.com/jsf/composite/albert"

这是用法示例

<albert:infoButton
    infoId="infoSingleRecord"
    params="transDateFrom transDateTo"
    mappingMethod="#{tBrowseBean_ConfirmedRPB.mapSendInfoSingleRecord}" />


这是放在resources/albert/infoButton.xhtml


And this is the component which is put in resources/albert/infoButton.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.prime.com.tr/ui"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface>
        <composite:attribute name="infoId" required="true" />
        <composite:attribute name="params" />
        <composite:attribute name="mappingMethod" method-signature="java.lang.String action()" />
    </composite:interface>

    <composite:implementation>
        <p:commandButton 
            process="@this #{cc.attrs.params}"
            actionListener="#{cc.attrs.mappingMethod}"
            update="#{cc.attrs.infoId}Panel"
            oncomplete="#{cc.attrs.infoId}Dialog.show()" 
            image="ui-icon ui-icon-search" />
    </composite:implementation>
</html>


但是运行它时,单击infoButton时,此异常跟踪显示在我的catalina.out日志文件中:


But running it, when clicking the infoButton, this exception trace shows in my catalina.out log file :

Apr 25, 2011 10:08:43 AM javax.faces.event.MethodExpressionActionListener processAction
SEVERE: Received 'javax.el.PropertyNotFoundException' when invoking action listener '#{cc.attrs.mappingMethod}' for component 'j_idt71'
Apr 25, 2011 10:08:43 AM javax.faces.event.MethodExpressionActionListener processAction
SEVERE: javax.el.PropertyNotFoundException: /TBrowse_tabConfirmedRPB.xhtml @33,77 mappingMethod="#{tBrowseBean_ConfirmedRPB.mapSendInfoSingleRecord}": Property 'mapSendInfoSingleRecord' not found on type mywebapp.paymentplan.TBrowseBean_ConfirmedRPB
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
    at com.sun.faces.facelets.el.ContextualCompositeMethodExpression.invoke(ContextualCompositeMethodExpression.java:184)
    at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:450)
    at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
    at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:777)
    at javax.faces.component.UICommand.broadcast(UICommand.java:300)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

ERROR BusinessExceptionHandler - BusinessExceptioHandler handles an unhandled exception: 
javax.faces.event.AbortProcessingException: /TBrowse_tabConfirmedRPB.xhtml @33,77 mappingMethod="#{tBrowseBean_ConfirmedRPB.mapSendInfoSingleRecord}": Property 'mapSendInfoSingleRecord' not found on type mywebapp.paymentplan.TBrowseBean_ConfirmedRPB
    at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:182)
    at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:777)
    at javax.faces.component.UICommand.broadcast(UICommand.java:300)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: javax.el.PropertyNotFoundException: /TBrowse_tabConfirmedRPB.xhtml @33,77 mappingMethod="#{tBrowseBean_ConfirmedRPB.mapSendInfoSingleRecord}": Property 'mapSendInfoSingleRecord' not found on type mywebapp.paymentplan.TBrowseBean_ConfirmedRPB
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
    at com.sun.faces.facelets.el.ContextualCompositeMethodExpression.invoke(ContextualCompositeMethodExpression.java:184)
    at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:450)
    at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
    ... 24 more


我想知道为什么会这样,因为在mywebapp.paymentplan.TBrowseBean_ConfirmedRPB中,我已经提供了此信息:


I wonder why is this happening, because at the mywebapp.paymentplan.TBrowseBean_ConfirmedRPB, i already provide this :

public String mapSendInfoSingleRecord(ActionEvent event) {                                                                                                                             
    System.out.println("mapSendInfoSingleRecord");                                                                                                                                 
    return null;                                                                                                                                                                   
}


然后,我尝试放置虚拟mapSendInfoSingleRecord字段,然后看看会发生什么:


And after that, i tried putting the dummy mapSendInfoSingleRecord field, and see what happens :

private String mapSendInfoSingleRecord;
public String getMapSendInfoSingleRecord() {
    return mapSendInfoSingleRecord;
}

public void setMapSendInfoSingleRecord(String mapSendInfoSingleRecord) {
    this.mapSendInfoSingleRecord = mapSendInfoSingleRecord;
}


但是单击按钮现在会产生此异常:


But clicking on the button now produces this exception :

Apr 25, 2011 10:32:46 AM javax.faces.event.MethodExpressionActionListener processAction
SEVERE: Received 'javax.el.MethodNotFoundException' when invoking action listener '#{cc.attrs.mappingMethod}' for component 'j_idt71'
Apr 25, 2011 10:32:46 AM javax.faces.event.MethodExpressionActionListener processAction
SEVERE: javax.el.MethodNotFoundException: Method not found: com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap@12f3802.mappingMethod()
        at org.apache.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:225)
        at org.apache.el.parser.AstValue.invoke(AstValue.java:253)
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
        at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:153)
        at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
        at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:777)
        at javax.faces.component.UICommand.broadcast(UICommand.java:300)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

ERROR BusinessExceptionHandler - BusinessExceptioHandler handles an unhandled exception: 
javax.faces.event.AbortProcessingException: Method not found: com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap@12f3802.mappingMethod()
        at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:182)
        at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
        at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:777)
        at javax.faces.component.UICommand.broadcast(UICommand.java:300)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: javax.el.MethodNotFoundException: Method not found: com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap@12f3802.mappingMethod()
        at org.apache.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:225)
        at org.apache.el.parser.AstValue.invoke(AstValue.java:253)
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
        at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:153)
        ... 24 more


我已经针对mojarra 2.0.4-b09和2.1.1-b04版本进行了测试,结果相同.


I've tested against mojarra version 2.0.4-b09 and 2.1.1-b04, with the same results.

我想知道我在这里做错了什么吗?

I wonder what I did wrong here ?

推荐答案

有两个问题:

首先,您已定义的复合method-signature

First, the composite method-signature which you've definied

<composite:attribute name="mappingMethod" method-signature="java.lang.String action()" />

与真实的方法签名不匹配

doesn't match with the real method signature

public String mapSendInfoSingleRecord(ActionEvent event) 

第二,actionListener方法应返回void而不是String.

Second, the actionListener methods should return void not String.

我假设您只想使用action方法,然后应更改实际方法签名以摆脱ActionEvent参数:

I assume that you just want a action method, you should then change the real method signature to get rid of the ActionEvent argument:

public String mapSendInfoSingleRecord() 

关于actionListeneraction,您可能会发现此问题/答案很有用: action和actionListener之间的区别.

As to actionListener vs action, you may find this question/answer useful: Differences between action and actionListener.

这篇关于javax.el.PropertyNotFoundException与CompositeComponent吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆