Reputation: 3808
How do you add new attributes to a component that doesn't define those attributes without creating your own.
I want to do something like this
<h:commandButton actionListener="#{manager.saveNew}" value="#{i18n['School.create']}" secured="true" />
or at least, a way to allow the developer to assign the secure attribute.
any ideas?
Upvotes: 2
Views: 1557
Reputation: 30025
You can use f:attribute
inside your h:commandButton
.
<h:commandButton actionListener="#{manager.saveNew}
value="#{i18n['School.create']}">
<f:attribute name="secured" value="true" />
</h:commandButton>
And in your action method:
public void saveNew(ActionEvent event) {
String secured = (String) event.getComponent().getAttributes().get("secured");
}
Here is a comprehensive tutorial on this topic.
Upvotes: 3