Sure....
Managed Bean:
<managed-bean>
<managed-bean-name>movieSearchResultsList</managed-bean-name>
<managed-bean-class>java.util.ArrayList</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
Backing Bean Logic:
public String quickSearchAction() throws Exception
{
FacesContext context = FacesContext.getCurrentInstance();
context.getApplication().createValueBinding("#{movieSearchResultsList}")
.setValue(context,
obtainMovieBusinessService().findMoviesByTitle(getSearchText()));
return "searchResults";
}
With this example the movieSearchResultsList is placed into request
scope not session scope.
Thanks
________________________________
From: Jason Lee [mailto:jason_at_steeplesoft.com]
Sent: Wednesday, October 03, 2007 10:30 AM
To: users_at_javaserverfaces.dev.java.net
Subject: Re: JSF 1.2/ Facelets/ Managed Bean Scope
I'm not sure I followed all of that. Can you send the relevant
snippets from your faces-config.xml and any Java code?
On 10/3/07, Butash, Bob < bob.butash_at_eds.com
<mailto:bob.butash_at_eds.com> > wrote:
I'm leveraging JSF 1.2 with Facelets and I'm running
into an error.
I have a backing bean the retrieves a list from the
model tier of the application, I then try to set the list as the value
of a configured managed bean. The managed bean is scoped to session
scope however I notice that if I just set the managed bean without
retrieving it first for some reason the managed bean's scope is set to
request instead of session per it's configuration.
The usecase
1. Leveraging JSF 1.2 and Facelets
2. Declare Managed Bean as session scope
3. Attempt to set the managed bean value without
previously obtaining it from the managed bean creation facility
With this scenario the managed bean is placed into
request scope not session scope. If I retrieve the managed bean
leveraging the managed bean creation facility, when I set it, it is
properly set into session scope. However, it doesn't seem right to have
a new list instantiated just so that I can throw it away. This did work
in my JSF 1.1 application.
Any help would be apprecriated.
Thanks
--
Jason Lee, SCJP
Software Architect -- Objectstream, Inc.
JSF RI Dev Team
http://blogs.steeplesoft.com