2

My JSF custom component code:

<composite:interface name="translation">
    <composite:attribute name="fieldName"/>
  <composite:attribute name="required" default="true" />
</composite:interface>

<composite:implementation>
    <h:inputText required="#{cc.attrs.required}" requiredMessage="Please enter #{cc.attrs.fieldName} in english"/>
</composite:implementation>

This works fine if I specify the required attribute as follows:

<comp:translation fieldName="myTranslation" required="true" />

But does not work if I give EL in required attribute of my composite component:

<comp:translation fieldName="myTranslation" required="#{param['someButtonId'] != null}" />

Can we give EL in attributes of composite components? If yes, then what I am missing?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Ok, I missed the point about `!=` Anyway, I have used EL in composite components and I have had no problem at all. – SJuan76 Jun 12 '12 at 16:18
  • May I assume that `someButtonId` is an oversimplified example? In reality the button's client ID is normally prepended with the ID of the parent `` (and any other parent `NamingContainer` component, if any). – BalusC Jun 12 '12 at 16:20
  • @BalusC I have set prependId="false" for the form. Also If I try required="#{1==2}" (or even "#{false}") it also not works. –  Jun 12 '12 at 16:24
  • @BalusC JSF Implementation: Mojarra JSF Implementation (javax.faces/2.0) 2.0.3 -FCS I was checking my jsf impl/ver :) –  Jun 12 '12 at 17:52
  • @BalusC I have told the jsf impl / ver did you look at it? –  Jun 13 '12 at 13:54
  • Same problem here. The component's attribute remains on its default value if EL is used. Seems related to [this question](http://stackoverflow.com/q/9205938/840977) and [this one](http://stackoverflow.com/q/12525420/840977). The first one has an answer, but the explanation is not quite clear to me and the approach seems overly complicated. Is there no other way? – Louise Sep 25 '12 at 14:17

0 Answers0