3

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.

Kermit
  • 2,865
  • 3
  • 30
  • 53

2 Answers2

4

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");
Paul Stephen Withers
  • 15,699
  • 1
  • 15
  • 33
3

I think you just made a simple "typo" as Paul stated indirectly in his reply. You wrote Javascript code but did not include the "javascript:" in the beginning of your expression.

If, however, you do want to use arguments with EL then have a look at this very interesting article. I haven't tried it out myself yet (but am going to do shortly) - but the two different examples (have a look at the comments) seem very interesting when you want to use EL. And I prefer EL over SSJS.

/John

John Dalsgaard
  • 2,797
  • 1
  • 14
  • 26