cbhogf
cbhogf

Reputation: 109

JSF - f:attribute boolean value

Is there a way to send boolean f:attribute value to the bean?

a tag usage:

<xyz:mytag isGreenColor="true" .../>

facelet:

<h:panelGroup binding="#{bean.field}">
<f:attribute name="isGreenColor" value="#{isGreen}"/>
</h:PanelGroup>

and if to send to bean how to read the attribute then - the boolean cast I mean?

Thanks

Upvotes: 0

Views: 770

Answers (1)

Ayhan Arslan
Ayhan Arslan

Reputation: 81

You can send to bean like this: ()

<p:commandLink value="" action="#{bean.func}" process="@this">
        <f:attribute name="isGreenColor" value="#{isGreen}"/>
</p:commandLink>

You can use anything instead of commandLink like: p:ajax

And you can read like this:

public void func(ActionEvent event) {
    Boolean isGreenColor = (Boolean) event.getComponent().getAttributes().get("isGreenColor");
}

Upvotes: 1

Related Questions