What I\'m looking for is to have an f:param tag with an Object of my own choosing in the value attribute. Then, in the backing bean method for the action, I would like to be
You can't do that with <f:param>
. It needs to be appended to the URL of the request, so it really needs to be a String
. Just use <f:setPropertyActionListener> instead.
E.g.
<h:commandLink value="Submit" action="#{bean.submit}">
<f:setPropertyActionListener target="#{bean.otherBean}" value="#{otherBean}" />
</h:commandLink>
This way the #{otherBean}
is just available as this.otherBean
inside submit()
method. This way you also don't need to mess with the request parameter map (for which in case of <f:param>
I would rather have used managed property injection with #{param.name}
instead).
Alternatives are using <h:inputHidden> in combination with a Converter
or using Tomahawk's <t:saveState>. Also see this blog article for more background info and examples.