0

I've created a composite component using Primefaces like this:

<composite:interface>
    <composite:attribute name="testText" />
</composite:interface>

<composite:implementation>
    <p:button id="testid#{cc.attrs.testText}" value="#{cc.attrs.testText}"
              widgetVar="testWidgetVar#{cc.attrs.testText}" />
</composite:implementation>

When I use the custom component with attribute testText="test"

I get the following behaviour:

  • "test" is displayed on the button (as expected)

  • the id of the button component is "testidtest" (as expected),

  • but the widgetVar is not "testWidgetVartest" as expected!

The debug output of the menu component is as follows:

<Button disableClientWindow="false" disabled="false" escape="true" iconPos="left" id="testidtest" inView="true" includeViewParams="false" inline="false" rendered="true" target="_self" transient="false" widgetVar="testWidgetVar"/>

Can someone explain that behaviour?

esel
  • 901
  • 9
  • 20

2 Answers2

0

The EL evaluation is not ready when the id and widgetVar attributes are processed in the JSF request-response cycle.

Some links related:

Why JSF calls getters multiple times

EL evaluation in a JSF page is not sequential

Javatutorial: JSF 2 Lifecycle

Community
  • 1
  • 1
Yamada
  • 723
  • 6
  • 23
  • Sry there was an error in the question. The id IS correctly set as testidtest, only the widgetVar attribute not. I don't see how this is connected to the lifecycle or the links you provided. – esel Feb 06 '14 at 12:10
0

Now I found out the problem: The debug output (Glassfish 4.0, Mojarra 2.2.0) is sometimes not displaying the actual state of the attributes correctly. The widgetVar is set correctly and can be used in the application although it doesn't show up in the debug output, so the problem is only in the debug output. I don't understand why that is. The only lesson I've learned is not to rely on the debug output.

esel
  • 901
  • 9
  • 20