myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Lessard" <simon.lessar...@gmail.com>
Subject Re: Bean scope problem
Date Fri, 11 May 2007 15:48:43 GMT
Hello,

Actually, "none" is a perfectly valid managed bean scope. It means "create
it every time".

As for the original poster's problem, you cannot inject a session scoped
value into a none scoped bean, see JSF specification section 5.3.1.3.

Also, that being said, you should not access a none scoped bean directly in
your pages, that scope was made mainly for managed-property injection like
you seem to do already.


Regards,

~ Simon

On 5/11/07, William Diaz Pabón <widipa@hotmail.com> wrote:
>
> <managed-bean-scope>none</managed-bean-scope>  ????
>
>
> it must define a scope the bean.
>
> opctions:
>
> 1) <managed-bean-scope>application</managed-bean-scope>
> 2) <managed-bean-scope>session</managed-bean-scope>
> 3) <managed-bean-scope>request</managed-bean-scope>
>
>
>
> Cordialmente.
>
> William Diaz Pabón
> Tunja - Boyacá - Colombia
>
>
>
>
>
> >From: "Leyzerzon, Simeon" <simeon.leyzerzon@credit-suisse.com>
> >Reply-To: "MyFaces Discussion" <users@myfaces.apache.org>
> >To: "'users@myfaces.apache.org'" <users@myfaces.apache.org>
> >Subject: Bean scope problem
> >Date: Fri, 11 May 2007 11:13:34 -0400
> >
> >Hi,
> >
> >I'm getting the following exception at runtime:
> >
> >javax.faces.el.EvaluationException: Cannot get value for expression
> >'#{searchHandler.intervalSelector.selectedIntervalTag}'
> >       at
> >org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java
> :405)
> >       at
> >org.apache.myfaces.application.ApplicationImpl.createComponent(
> ApplicationImpl.java:427)
> >       at
> >javax.faces.webapp.UIComponentTag.createComponentInstance(
> UIComponentTag.java:881)
> >       at
> >javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:768)
> >       at javax.faces.webapp.UIComponentTag.doStartTag(
> UIComponentTag.java:472)
> >       Truncated. see log file for complete stacktrace
> >javax.faces.el.EvaluationException: Cannot get value for expression
> >'#{userControlsHandler}'
> >       at
> >org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java
> :405)
> >       at
> >
> org.apache.myfaces.config.impl.digester.elements.ManagedProperty.getRuntimeValue
> (ManagedProperty.java:130)
> >       at
> >org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(
> ManagedBeanBuilder.java:170)
> >       at
> >org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(
> ManagedBeanBuilder.java:55)
> >       at
> >org.apache.myfaces.el.VariableResolverImpl.resolveVariable(
> VariableResolverImpl.java:314)
> >       Truncated. see log file for complete stacktrace
> >javax.faces.FacesException: Property searchService references object in a
> >scope with shorter lifetime than the target scope none
> >       at
> >org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(
> ManagedBeanBuilder.java:167)
> >       at
> >org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(
> ManagedBeanBuilder.java:55)
> >       at
> >org.apache.myfaces.el.VariableResolverImpl.resolveVariable(
> VariableResolverImpl.java:314)
> >       at
> >
> org.apache.myfaces.custom.redirectTracker.RedirectTrackerVariableResolver.resolveVariable
> (RedirectTrackerVariableResolver.java:41)
> >       at
> >
> org.apache.myfaces.custom.security.SecurityContextVariableResolver.resolveVariable
> (SecurityContextVariableResolver.java:45)
> >       Truncated. see log file for complete stacktrace
> >
> >
> >Could someone please help figure it out?
> >Here is the faces-config.xml file:
> >
> >
> ><?xml version="1.0" encoding="UTF-8"?>
> ><!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer
> >Faces Config 1.0//EN"
> >
> >"http://java.sun.com/dtd/web-facesconfig_1_0.dtd
> ><http://java.sun.com/dtd/web-facesconfig_1_0.dtd> ">
> ><faces-config>
> >
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>searchHandler</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SearchHandler
> </managed-bean-class>
> >               <managed-bean-scope>session</managed-bean-scope>
> >               <managed-property>
> >                       <property-name>controls</property-name>
> >                       <value>#{userControlsHandler}</value>
> >               </managed-property>
> >               <managed-property>
> >                       <property-name>searchService</property-name>
> >                       <value>#{searchService}</value>
> >               </managed-property>
> >
> >               <managed-property>
> >                       <property-name>categorySelector</property-name>
> >                       <value>#{selectCategories}</value>
> >               </managed-property>
> >               <managed-property>
> >                       <property-name>intervalSelector</property-name>
> >                       <value>#{selectIntervals}</value>
> >               </managed-property>
> >               <managed-property>
> >                       <property-name>userActionSelector</property-name>
> >                       <value>#{selectUserActions}</value>
> >               </managed-property>
> >               <managed-property>
> >
> <property-name>searchCommandsController</property-name>
> >                       <value>#{commandsController}</value>
> >               </managed-property>
> >               <managed-property>
> >
> <property-name>searchPanelStackController</property-name>
> >                       <value>#{searchPanelStackController}</value>
> >               </managed-property>
> >               <managed-property>
> >                       <property-name>regionSelector</property-name>
> >                       <value>#{selectRegions}</value>
> >               </managed-property>
> >               <managed-property>
> >
> <property-name>bookingCountrySelector</property-name>
> >                       <value>#{selectBookingCountries}</value>
> >               </managed-property>
> >               <managed-property>
> >
> <property-name>reportingLineSelector</property-name>
> >                       <value>#{selectReportingLines}</value>
> >               </managed-property>
> >               <managed-property>
> >
> <property-name>clientNameController</property-name>
> >                       <value>#{clientNameController}</value>
> >               </managed-property>
> >               <managed-property>
> >                       <property-name>cifController</property-name>
> >                       <value>#{cifController}</value>
> >               </managed-property>
> >               <managed-property>
> >                       <property-name>facilityController</property-name>
> >                       <value>#{facilityController}</value>
> >               </managed-property>
> >
> >
> >
> >               <managed-property>
> >
> <property-name>creditPurposeSelector</property-name>
> >                       <value>#{selectCreditPurposes}</value>
> >               </managed-property>
> >               <managed-property>
> >
> <property-name>searchResultsHandler</property-name>
> >                       <value>#{searchResultsHandler}</value>
> >               </managed-property>
> >
> >       </managed-bean>
> >
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>searchService</managed-bean-name>
> >               <managed-bean-class>com.csfb.fao.clr.service.SearchService
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>userControlsHandler</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.UserControlsHandler
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >
> >               <managed-property>
> >                       <property-name>searchService</property-name>
> >                       <value>#{searchHandler.searchService}</value>
> >               </managed-property>
> >
> >               <managed-property>
> >
> <property-name>reportingPeriodSelector</property-name>
> >                       <value>#{selectReportingPeriods}</value>
> >               </managed-property>
> >       </managed-bean>
> >
> >       <managed-bean>
> >               <description/>
> >
> <managed-bean-name>selectReportingPeriods</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SelectReportingPeriods
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>selectCategories</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SelectCategories
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>selectIntervals</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SelectInterval
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>selectUserActions</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SelectUserAction
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>commandsController</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SearchCommandsController
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >
> <managed-bean-name>searchPanelStackController</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SearchPanelStackController
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>selectRegions</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SelectRegion
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >
> <managed-bean-name>selectBookingCountries</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SelectBookingCountry
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >
> >       <managed-bean>
> >               <description/>
> >
> <managed-bean-name>clientNameController</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.ClientNameController
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>cifController</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.CIFController
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >               <managed-bean-name>facilityController</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.FacilityController
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >
> >       <managed-bean>
> >               <description/>
> >
> <managed-bean-name>selectReportingLines</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SelectReportingLine
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >       <managed-bean>
> >               <description/>
> >
> <managed-bean-name>selectCreditPurposes</managed-bean-name>
> >               <managed-bean-class>
> com.csfb.fao.clr.controller.maintenance.search.SelectCreditPurpose
> </managed-bean-class>
> >               <managed-bean-scope>none</managed-bean-scope>
> >       </managed-bean>
> >
> >
> ></faces-config>
> >
> >
> >
> >Thank you,
> >Simeon
> >
>
> >==============================================================================
> >Please access the attached hyperlink for an important electronic
> >communications disclaimer:
> >
> >http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>
> >==============================================================================
>
> _________________________________________________________________
> Las mejores tiendas, los precios mas bajos, entregas en todo el mundo,
> YupiMSN Compras: http://latam.msn.com/compras/
>
>

Mime
View raw message