You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by bansi <ma...@yahoo.com> on 2007/07/10 23:55:23 UTC
Session OR Request Scope - JSF
My Search Backing Bean (JSF) displays the resultSet as list of object
properties along with a hyperlink for Edit/Update.
When i click on the hyperlink Edit , i am passing "id" value of the object,
so that i can load the object , which eventually renders data on Update Form
I have defined the "id" as managed-property in faces-config.xml . It works
only if the managed-bean is defined under "request" scope. Otherwise it
throws the following exception for Session scope
javax.faces.FacesException: Property id references object in a scope with
shorter lifetime than the target scope session
Please note my requirement is to have managed-bean in session scope as it
has lots of other stuff like h:selectManyListBox which works only in session
scope
Any pointers/suggestions will be highly appreciated
--
View this message in context: http://www.nabble.com/Session-OR-Request-Scope---JSF-tf4058743.html#a11530287
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Session OR Request Scope - JSF
Posted by bansi <ma...@yahoo.com>.
Hi Cagatay
Thanks for quick response. I tried <t:saveState id="save1"
value="#{searchBean.id}" /> but it didnt help
Having session scoped bean is really a requirement for me as i am doing lot
of other stuff like using h:selectManyListBox to add/remove Roles etc
I have id defined as the property in my backing bean i.e. session-scoped
managed bean with a managed property bound to a querystring parameter id
<managed-bean>
<managed-bean-name>userBean</managed-bean-name>
<managed-bean-class>project.UserBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>userId</property-name>
<value>#{param.userId}</value>
</managed-property>
</managed-bean>
My workaround is to get the request parameter from the ExternalContext in my
property's getter method
Any pointers/suggestions on how to do this will be highly appreciated
Cagatay Civici wrote:
>
> Hi,
>
> That's because in jsf ioc you cannot inject objects with short scope to
> the
> ones in longer scope, like in this request-session example.
>
> Is the session scoped bean really a requirement, maybe you can try
> t:savestate instead of http session to keep the data alive.
>
> Cagatay
>
> On 7/11/07, bansi <ma...@yahoo.com> wrote:
>>
>>
>> My Search Backing Bean (JSF) displays the resultSet as list of object
>> properties along with a hyperlink for Edit/Update.
>>
>> When i click on the hyperlink Edit , i am passing "id" value of the
>> object,
>> so that i can load the object , which eventually renders data on Update
>> Form
>>
>>
>>
>> I have defined the "id" as managed-property in faces-config.xml . It
>> works
>> only if the managed-bean is defined under "request" scope. Otherwise it
>> throws the following exception for Session scope
>>
>>
>>
>> javax.faces.FacesException: Property id references object in a scope with
>> shorter lifetime than the target scope session
>>
>>
>>
>> Please note my requirement is to have managed-bean in session scope as it
>> has lots of other stuff like h:selectManyListBox which works only in
>> session
>> scope
>>
>>
>>
>> Any pointers/suggestions will be highly appreciated
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Session-OR-Request-Scope---JSF-tf4058743.html#a11530287
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Session-OR-Request-Scope---JSF-tf4058743.html#a11531490
Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Session OR Request Scope - JSF
Posted by Cagatay Civici <ca...@gmail.com>.
Hi,
That's because in jsf ioc you cannot inject objects with short scope to the
ones in longer scope, like in this request-session example.
Is the session scoped bean really a requirement, maybe you can try
t:savestate instead of http session to keep the data alive.
Cagatay
On 7/11/07, bansi <ma...@yahoo.com> wrote:
>
>
> My Search Backing Bean (JSF) displays the resultSet as list of object
> properties along with a hyperlink for Edit/Update.
>
> When i click on the hyperlink Edit , i am passing "id" value of the
> object,
> so that i can load the object , which eventually renders data on Update
> Form
>
>
>
> I have defined the "id" as managed-property in faces-config.xml . It works
> only if the managed-bean is defined under "request" scope. Otherwise it
> throws the following exception for Session scope
>
>
>
> javax.faces.FacesException: Property id references object in a scope with
> shorter lifetime than the target scope session
>
>
>
> Please note my requirement is to have managed-bean in session scope as it
> has lots of other stuff like h:selectManyListBox which works only in
> session
> scope
>
>
>
> Any pointers/suggestions will be highly appreciated
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Session-OR-Request-Scope---JSF-tf4058743.html#a11530287
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>