Search code examples
xpagesargument-passingmanaged-bean

Xpages Combobox setting values in managed bean


I am trying to pass arguments to a managed bean. The bean is configured and works, has two methods "getResponsible" and "setResponsible". Calling "myLookup.responsible" works.

I cannot pass arguments to my bean, and can't figure out why. The below code does not work.

  <xp:comboBox id="comboBox1">
  <xp:selectItems>
  <xp:this.value><![CDATA[#{myLookup.setResponsible("Something")}]]>
  </xp:this.value>
  </xp:selectItems>
  </xp:comboBox>

As soon as I type paranthesis ")", "(" or semicolon ";" i get error "Error in EL syntax". I guess I am making some fundamental mistake here.


Solution

  • The version of expression language does not allow parameters to easily be passed. This option may work http://blog.defrog.nl/2012/04/settings-bean-parameterized-method-call.html.

    If parameters are required, I usually use SSJS, so:

    #{javascript:myLookup.setResponsible("Something");
    

    If the options won't vary during the page's life, you can always compute on page load, so:

    ${javascript:myLookup.setResponsible("Something");