What is the purpose of the rendered f: viewAction attribute?

The attribute description is rendered

f:viewAction

not specified in the official documentation .

I thought that if it contains an expression that evaluates to false, the expression action

will not execute like the following example:

<f:viewAction
    action="#{javax.enterprise.context.conversation.begin()}"
    rendered="#{javax.enterprise.context.conversation.isTransient()}"
/>

      

But action

it is always executed no matter what the attribute evaluates rendered

.

So what is its purpose?

+2


source to share


1 answer


You are probably a victim of attribute evaluation time rendered

. You are safer using the attribute if

viewAction

as your use case is the only target:

     <f:viewAction action="#{javax.enterprise.context.conversation.begin()}"
if="#{javax.enterprise.context.conversation.isTransient()}"/>

      

The attribute if

does a view action only if it evaluates to a value true

, and the new one is with JSF2.



on this topic:

+1


source







All Articles