File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Passing attributes with <ice:commandButton> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Passing attributes with <ice:commandButton>" Watch "Passing attributes with <ice:commandButton>" New topic

Passing attributes with <ice:commandButton>

Peter Fat

Joined: Oct 18, 2010
Posts: 24

I have several buttons, and I want each of of them to pass an attribute to the backing bean. How do I do this? I googled it several times, but I always get answers in completely different contexts... Is this not possible?

I have read that I can't pass <f:param> with command buttons. Is this true? All I need to pass is a string.
Cesar Loachamin
Ranch Hand

Joined: Dec 25, 2010
Posts: 90

Hi Peter

Hi Peter, sure you can pass parameters for your UI to your bean, and you can do it for different ways, but you can use a <f:param> or <f:attribute>, If you use the f:param in a commandButton or commandLink the value of the param is turned into a request parameter. When you use f:attribute you're attaching this attribute to the map of attributes of the component, I give you an example of how to use it.

An the method listener for the action event.

I hope this help you with your question

When a dream is ending because to come true - OCPJP 6,7. OCE JPA EE6. MCTS
Peter Fat

Joined: Oct 18, 2010
Posts: 24
Many thanks, mate!
I agree. Here's the link:
subject: Passing attributes with <ice:commandButton>
It's not a secret anymore!