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 able to pull this Object from the request. (Sorry if my terminology isnt so good, I'm new to JSF).
Now, I can pass Strings around in request parameters just fine. I also realize that a parameter is always going to be a String in the http get or post, so I'm not really passing a java object. I also realize that a way to do this would be to pass an "id" of some kind which the backing bean could then use to identify the Object in question.
What I'm wondering, however, is if JSF will allow me to do this transparently. Can I specify any object as the value of the param and then just fetch it from the RequestMap in an action method?
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 aString
. Just use<f:setPropertyActionListener>
instead.E.g.
This way the
#{otherBean}
is just available asthis.otherBean
insidesubmit()
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 aConverter
or using Tomahawk's<t:saveState>
. Also see this blog article for more background info and examples.