Results 1 to 6 of 6

Thread: Facelets, Template - does not reference a MethodExpression

  1. #1
    Join Date
    Jul 2006
    Location
    London
    Posts
    500

    Default Facelets, Template - does not reference a MethodExpression

    I am getting an exception with my Facelet tag which has a variable for a commandLink action property named event. If the variable is replaced with a hardcoded string its works (but isnt very useful).

    I am using Facelets/JSF for the view obviously.

    Code:
    <h:commandLink action="${event}" ...>
    Code:
    javax.faces.el.EvaluationException: /WEB-INF/facelets/tags/myfaces/column-command-link.xhtml @12,75 action="${event}": Identity 'event' does not reference a MethodExpression instance, returned type: java.lang.String
    	com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
    	org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
    	javax.faces.component.UICommand.broadcast(UICommand.java:109)
    	javax.faces.component.UIData.broadcast(UIData.java:517)
    Anyone come across this problem?

  2. #2
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    Are you trying to extract the value of 'event' from a page property?

    I would not expect this to work. The action property needs to either be a hardcoded string, or it needs to be a method expression that resolves to a no-arg method that returns a String.

    -Jeremy

  3. #3
    Join Date
    Jul 2006
    Location
    London
    Posts
    500

    Default

    Quote Originally Posted by jeremyg484 View Post
    Are you trying to extract the value of 'event' from a page property?

    I would not expect this to work. The action property needs to either be a hardcoded string, or it needs to be a method expression that resolves to a no-arg method that returns a String.

    -Jeremy
    Hi Jeremy

    Yes, the transition event id its being passed into the template.

    Tag
    Code:
    <xxx:columnCommandLink title="#{messages['label.name']}" ... event="#{backingBean.select}">
      ...
    </xxx:columnCommandLink>
    Template
    Code:
    <h:commandLink ... action="${event}" ...>
     ..
    </h:commandLink>
    If I hardcode the action in the template as a string or method expression it works...its there no way to pass this value as a variable...this currently only seems to not work on the 'action' property of commandLink.

    Regards.

  4. #4
    Join Date
    Jul 2006
    Location
    London
    Posts
    500

    Default

    Resolved.

    Format of action must be: action="#{<backingBean>[<event>]}"

    For value bindings you can use this format #{<backingBean>.<event>}

  5. #5
    Join Date
    Sep 2009
    Posts
    13

    Unhappy

    I couldnīt manage to get this working...

    My template source:

    Code:
    	<rich:toolBarGroup>
    		<a4j:commandLink action="#{action}" styleClass="toolbar-button">
    			<h:graphicImage id="#{id}" value="#{image}" title="#{label}" style="vertical-align: middle;"/>
    			<h:outputLabel for="#{id}" value="#{label}" style="vertical-align: middle;" />
    		</a4j:commandLink>
    	</rich:toolBarGroup>
    My page source:
    Code:
    <sdtt:toolbarButton id="new" label="Nova Sir" image="/images/newitem.gif" action="newSir" />
    And I get the following error: "Identity 'action' does not reference a MethodExpression instance, returned type: java.lang.String".

    Any hints?

  6. #6
    Join Date
    Sep 2009
    Posts
    13

    Default Solved!

    I solved my problem using the ActionMapperTagHandler solution from the richfaces photoalbum example app.

    Itīs simple, but it took me a lot of googling to find:

    http://docs.jboss.org/richfaces/late...ml/Button.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •