3

I have a JSF composite component which is a list of email addresses that can be dynamically added to, and deleted from:

<composite:interface shortDescription="Display party email addresses">
    <composite:attribute name="addressable" required="true"/>
</composite:interface>

<composite:implementation>  
    <h:panelGroup layout="block" id="emails">
        <h:dataTable id="emailList" value="#{cc.attrs.addressable.emailAddresses}" var="email" styleClass="data-list small-list" cellpadding="0" cellspacing="0">
            <h:column>
                <f:facet name="header">Address</f:facet>
                <h:inputText id="emailAddress" value="#{email.address}" size="30" maxlength="100" required="true" label="Email"/>
            </h:column>
            <h:column>
                <f:facet name="header">Description</f:facet>
                <h:inputText id="emailDescription" value="#{email.description}" size="20" maxlength="100"/>
            </h:column>        
            <h:column>
                <f:facet name="header">
                    <h:panelGroup styleClass="right-align" layout="block">
                        <h:commandLink id="addEmail" action="#{cc.attrs.addressable.addEmailAddress}" title="Add an email address">
                            <f:ajax execute=":#{cc.clientId}:emails" render=":#{cc.clientId}:emails"/>
                            <h:graphicImage library="images" name="add.png" id="emailAddImg"/>
                        </h:commandLink>
                    </h:panelGroup>
                </f:facet>
                <h:commandLink id="deleteEmail" action="#{cc.attrs.addressable.remove(email)}" title="Remove the email from this row">
                    <f:ajax execute=":#{cc.clientId}:emails" render=":#{cc.clientId}:emails"/>
                    <h:graphicImage library="images" name="delete.png" id="emailDeleteImg"/>
                </h:commandLink>
            </h:column>          
        </h:dataTable> 
    </h:panelGroup>
</composite:implementation>

This component is used as follows:

<edit:emailAddresses addressable="#{personAddressable}" id="emailAddresses"/>

Where the 'deleteEmail' action is invoked it causes an exception:

ERROR [STDERR] Caused by: javax.el.MethodNotFoundException: /resources/edit/emailAddresses.xhtml @34,130 action="#{cc.attrs.addressable.remove(email)}": Method not found: No-Interface view for endpoint [ jboss.j2ee:jar=tephra.war,name=PersonAddressable,service=EJB3 ] and session 3j011-mgweoj-ghfwhlvv-1-ghfy2e5j-e1.remove()

However if the action is changed to personAddressable.remove(email) it works! This seems like simple parameter substitution and shouldn't make any difference. The action for adding an email address, which does not have a parameter, works fine.

I won't post the code for the backing bean as I've proved it works. But for reference it is a stateful conversation scoped bean (CDI).

I am using JBoss AS6-M5 which uses el 2.2.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Andrew
  • 31
  • 1
  • 2
  • Mojarra 2.0.2-FCS according to jar-versions.xml. Good point though. I might try getting the latest and greatest to see if this helps. – Andrew Dec 09 '10 at 01:30
  • Actually, just upgraded to JBoss6-CR1 which has Mojarra 2.0.3 and MyFaces 2.0.1. Neither of these implementations has resolved the problem. This hardly surprises me as the jboss-el implementation is the same for both M5 and CR1 (1.0_02.CR2). – Andrew Dec 09 '10 at 03:21

1 Answers1

4

I could reproduce the problem on Tomcat 7.0.5, but not on Glassfish 3.0.1. This means that there's a bug in EL implementation of Tomcat. I've reported a bug about it: Tomcat Bug 50449.

Since JBoss is under the covers using a fork of Tomcat, it's not a surprise that the same bug could manifest in JBoss as well.

You could (temporarily) workaround this by using f:setPropertyActionListener instead.

<h:commandLink action="#{cc.attrs.addressable.remove}">
    <f:setPropertyActionListener target="#{cc.attrs.addressable.email}" value="#{email}" />

in combination with an email property in the Addressable bean, with at least a setter.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Good sleuthing. Thanks for putting the effort in to investigate this. Nothing to do but to wait for a fix or work around it. – Andrew Dec 10 '10 at 23:33
  • They've *finally* fixed it: https://issues.apache.org/bugzilla/show_bug.cgi?id=52445 It will be available in Tomcat 7.0.24. Thanks to this question, I re-posted the bug report: http://stackoverflow.com/questions/8795009/cannot-pass-arguments-to-a-method-through-el-javax-el-methodnotfoundexception – BalusC Jan 13 '12 at 20:32