File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes How to assign a value to a request scoped managed bean property? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to assign a value to a request scoped managed bean property?" Watch "How to assign a value to a request scoped managed bean property?" New topic
Author

How to assign a value to a request scoped managed bean property?

Amy N. Snow
Greenhorn

Joined: Apr 09, 2008
Posts: 20
I have a action method called submit. That method is inside a managed bean with session scope. At the end of the submit() method I want to invalidate the session but I would like to keep a number to display after the session is invalidated. How can I store that number in a request scoped managed bean?

This is the request managed bean:

<managed-bean>
<managed-bean-name>confirmationMsg</managed-bean-name>
<managed-bean-class>beans.Messages</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>message</property-name>
<property-class>java.lang.String</property-class>
<value>#{form.number}</value>
</managed-property>
</managed-bean>

I've tried setting the value to the property number of the form bean but the value is blank after I invalidate the session.


Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

After you invalidate the session, EVERYTHING below application scope should be wiped out.

However, request-scope objects have an even shorter lifespan. They get reconstructed for each HTTP request. Hence the name "request" scope.


Customer surveys are for companies who didn't pay proper attention to begin with.
Amy N. Snow
Greenhorn

Joined: Apr 09, 2008
Posts: 20
Tim Holloway wrote:After you invalidate the session, EVERYTHING below application scope should be wiped out.

However, request-scope objects have an even shorter lifespan. They get reconstructed for each HTTP request. Hence the name "request" scope.


Everything below the session, not the application scope. I know the request scope beans are alive through the request that's why I need one after I invalidate the session, but I do not know how to store information into the request managed bean from the backing bean method. I've seen the setValue method from the ValueBind but I understand that is deprecated in JSF 1.2 and I wanted to know the best approach.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to assign a value to a request scoped managed bean property?
 
Similar Threads
JSF and REST urls
JSF backingbean value is null always.
Correct way to assign a value to a managed bean from a class?
Obtaining an instance of a Managed Bean declared with Application Level Scope
Similar logic:notPresent in JSF