request parameters

I've got a url being generated out of some javascript:

addnewitem.jsp?parentID=999

addnewitem.jsp has a backing bean with a parentID attribute.

The addnewitem.jsp takes some user input, and submits back to the FacesServlet

I'd like to set the backing bean parentID attribute with the value from the request

I've tried setting a managed bean property like this:

<managed-property>

<property-name>parentID</property-name>

<value>#{param.parentID}</value>

</managed-property>

And a hidden input in the jsp:

<h:inputHidden id="parentID" value="#BackBean.parentID}" />

Which works when addnewitem.jsp is rendered.

But when I submit the form on addnewitem.jsp, because there is no parentID in the request, jsf tries to assign null to backing bean's attribute

I'm not sure what the best way is to work around this issue.

Any pointers?

I'm starting to think that I really don't want the app server to manage the parentID property, but if not, how can I initialize parentID from the request when using a managed bean?

[1140 byte] By [mgrommeta] at [2007-11-27 10:36:01]
# 1

This looks like a case where you would use a regular hidden input instead of the JSF inputHidden component.

RaymondDeCampoa at 2007-7-28 18:38:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I'd be interested to know how to best use this method with jsf and a backing bean.

Do you know of an example where this is discussed, or perhaps you could give an example?

mgrommeta at 2007-7-28 18:38:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Which method?

Anyway, the following URL's might give some pointers:

http://balusc.xs4all.nl/srv/dev-jep-com.html

http://balusc.xs4all.nl/srv/dev-jep-prg.html

BalusCa at 2007-7-28 18:38:30 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...