No, no.

I think we do the same. I use spring beans in JSF without configuring
them extra in JSF, I just don't use the property resolver.

You can't go the other way round.

You can leave out the StartupServletContextListener, and nothing in
the whole app will change. This listener is in there for an issue with
the WebLogic container, which has been fixed already.

regards,

Martin

On 4/2/06, Philippe Lamote <[EMAIL PROTECTED]> wrote:
> Hi Martin (and Marco & Matt!), first of all thanks a lot for taking
> the time to reply guys.
>
> @ Martin: I think I will indeed avoid throwing yet another component
> at it, currently I am already using Sping, MyFaces, JPOX (JDO2), ...
> That'll do :-)
> Certainly if apparently I can do without.
>
>  From your reply I understand (correct me if I'm wrong) that you use
> the injection from an opposite angle: JSF beans in your Spring config
> file (your solution) instead of Spring beans in the faces-config
> file. (my approach)
> Is this what you meant or did I misundestood?
> I guess, looking at the results I get, your approach will be the
> recommended one as clearly the injection doing it my way doesn't work
> unless you apply that 'hack' in the constructor. I call it 'hack' as
> it's not elegant. It hardwires instead of injects.
>
> As for your scope remark (your point Nr4) I understood from quickly
> reading the Spring 2 docs (not yet using it though - first have to
> get this project bugfree!!!!) that Sping 2 beans do actually feature
> "scope" so that problem may not have to be addressed in the JSF
> domain anymore, as it can just be used from the Spring (-2) domain.
>
> About the last question "StartupServletContextListener": the question
> was meant broader, apart from this issue: is it necessary to include
> this line in the web.xml when using MyFaces? I have seen both
> (MyFaces-)  examples with and without it. My guess (and fear if I
> drop it) is that the JSF (MyFaces) context params won't be read
> anymore if you omit this line? (like "javax.faces.CONFIG_FILES",
> "javax.faces.STATE_SAVING_METHOD", ... )?
>
>
> Best Regards,
> Philippe Lamote
>
> Ps Anyone knows whether smth changed for the Spring-JSF integration
> between Spring v.1 & v2? (looking at teh doc on the Spring site, I
> would say "no" unless they haven't updated that part yet)
>
> ____________________
>
> On 02 Apr 2006, at 19:07, Martin Marinschek wrote:
>
> Hi Philippe,
>
> let me try to shed some light onto the problem:
>
> 1) jsf-spring (the library) is nice, but not necessary. Spring's JSF
> variable resolver is good enough.
>
> 2) We used jsf-spring (the library) on a large project, and ran into
> class-loader issues under Websphere. Use it on your own risk.
>
> 3) Spring's included JSF variable resolver is nice - and I use it
> regularly for resolving spring-beans. I don't use it to inject spring
> beans int JSF beans, though. I suppose it should work, though, with
> looking at the code. If you want to dig deeper:
>
> ManagedBeanBuilder.initializeProperties
>
> should call
>
> VariableResolver.resolveVariable
>
> and there, your spring-bean should be used.
>
> 4) One word of warning: Spring beans will not be able to think in
> terms of scope - or put otherway, they'll always have a scope of
> "none" or "application". Manfred was trying to find a solution for
> this before he went on vacations, maybe he'll come up with something
> after returning totally refreshed ;). Maybe this is the problem,
> though. Not sure.
>
> 5) You're right - the StartupServletContextListener doesn't have
> anything to do with the problem.
>
> Werner, are you using injection of spring beans into JSF beans?
>
> regards,
>
> Martin
>
> On 4/2/06, Matt Raible <[EMAIL PROTECTED]> wrote:
> > At first glance, everything looks correct. You could try downloading
> > Equinox and comparing your configuration.
> >
> > https://equinox.dev.java.net/servlets/ProjectDocumentList?
> > folderID=4847
> >
> > There's a pre-built JSF version available - with Spring and Hibernate
> > on the backend.  You'll need a database whose settings match
> > WEB-INF/classes/jdbc.properties in order to deploy it.
> >
> > https://equinox.dev.java.net/files/documents/1901/30019/equinox-
> > jsf.war
> >
> > Matt
> >
> > On 4/2/06, Philippe Lamote <[EMAIL PROTECTED]> wrote:
> >> Hi List,
> >>
> >> I'm getting unexplainable MyFaces-Spring integration problems, I was
> >> hoping someone could give a hint.
> >>
> >> 1/ First some setup info: I followed the Sping & JSF doc and did this
> >> to integrate the two: (I will try to be being extensive as big errors
> >> often small roots...)
> >>
> >> 1.1 Libs were added (in web-inf/lib of course; spring.jar & spring-
> >> web.jar) Tools I use are: Eclipse 3.2, WTP plugin, Tomcat 5.12 and
> >> Spring 1.2
> >> 1.2 web.xml features:
> >>
> >> <context-param>
> >>        <param-name>contextConfigLocation</param-name>
> >>        <param-value>/WEB-INF/applicationContext.xml</param-value>
> >>     </context-param>
> >>     <context-param>
> >>        <param-name>log4jConfigLocation</param-name>
> >>        <param-value>/WEB-INF/log4j.properties</param-value>
> >>     </context-param>
> >>
> >> <context-param>
> >>         <param-name>javax.faces.CONFIG_FILES</param-name>
> >>          <param-value>/WEB-INF/faces-config.xml</param-value>
> >>      </context-param>
> >>
> >> ... and:
> >>
> >>   <listener>
> >>        <listener-
> >> class>org.apache.myfaces.webapp.StartupServletContextListener</
> >> listener-class>
> >>    </listener>
> >>
> >> ... and:
> >>
> >>    <listener>
> >>           <listener-
> >> class>org.springframework.web.util.Log4jConfigListener</listener-
> >> class>
> >>     </listener>
> >>
> >>        <listener>
> >>           <listener-
> >> class>org.springframework.web.context.ContextLoaderListener</
> >> listener-
> >> class>
> >>        </listener>
> >>
> >> 1.3 faces-config file features:
> >>
> >> <application>
> >>          <variable-resolver>
> >>                org.springframework.web.jsf.DelegatingVariableResolver
> >>          </variable-resolver>
> >>
> >>
> >>          <locale-config>
> >>              <default-locale>fr</default-locale>
> >>              <supported-locale>nl</supported-locale>
> >>            <supported-locale>en</supported-locale>
> >>          </locale-config>
> >> </application>
> >> .... and an exampe how the JSF Managed beans are declared in this
> >> faces-config.xml with Spring Managed beans: ("webfacade" is a Spring
> >> Managed bean, cf Sping config file further)
> >>
> >> <managed-bean>
> >>                 <managed-bean-name>managerbean</managed-bean-name>
> >>                 <managed-bean-
> >> class>be.mnemonica.web.beans.ManagerBean</managed-
> >> bean-class>
> >>                 <managed-bean-scope>session</managed-bean-scope>
> >>                 <managed-property>
> >>                         <property-name>facade</property-name>
> >>                         <value>#{webfacade}</value>
> >>                 </managed-property>
> >> </managed-bean>
> >>
> >> 1.4 Sping applicationContext.xml: (extrait)
> >>
> >> <bean id="jdo2Persistor"
> >> class="be.mnemonica.persistence.JDO2PersistenceDelegator" >
> >>         <property name="modelPackageName">
> >>                 <description> The name of the package where the
> >> model classes of
> >> the application reside, for which this Persistence Delegator is
> >> written) </description>
> >>                 <value>be.mnemonica.model</value>
> >>         </property>
> >>         <property name="appMgr"><ref local="appmgr"/></property>
> >>
> >> </bean>
> >>
> >> <bean id="webfacade" class="be.mnemonica.client.WebFacade">
> >>         <property name="persistor">
> >>                 <description>The Persistor Delegator for the
> >> Facade. </description>
> >>                 <ref local="jdo2Persistor"/>
> >>         </property>
> >> </bean>
> >>
> >> The idea is: this WebFacade is used by all JSF Managed beans to
> >> delegate calls to the proper Delegator (e.g. CRUD Model-related calls
> >> are delegated to the PersistenceDelgatorInterface - I have Sping
> >> inject this Interface with a JDO2 Implementation implementing this
> >> Interface.
> >>
> >> Just to be explicit:
> >>         I have NOT declared my Spring beans as JSF manage beans
> >> (should I?)
> >>         I don't inject any Spring Managed bean with a JSF Managed
> >> bean
> >>
> >> 2/ Yet, the problems I'm having are substantial.
> >> The JSF Managed beans just DON'T seem to be injected with
> >> Sping-"filled" instances (the supposedly injected values are null)
> >> E.g. in the case above, "modelPackageName" remained "null".
> >> I could solve some issues by putting in all the JSF Managed beans'
> >> Constructors: (e.g. in this JSF managerbean)
> >>         ApplicationContext ctx =
> >> FacesContextUtils.getWebApplicationContext
> >> (FacesContext.getCurrentInstance());
> >>         facade = (WebFacade)ctx.getBean("webfacade");
> >>
> >> Yet of course this is a pity; I'm hardwiring again & creating
> >> explicit dependancies to Spring. (which is... the opposite of why I
> >> turned to Spring in the first place!! :-))
> >>
> >> --> Anyone else had issues like this? (or did I forget smth?)
> >> Or, even if not, any genious idea how to make this work properly? (a
> >> lesser genius idea that works will be admired as well ;-)
> >>
> >>   & Just to make sure I get the sequence right, is it correct that
> >> this is the mechanism:
> >> By these settings, every time a JSF Managed bean creates a JSF bean,
> >> Spring intervenes and injects (in cascade) the configured
> >> properties. So
> >> JSF bean creation USES Spring pre-configured Properties.
> >> Last and least (small sub question) I haven't noticed a difference
> >> when I leave the MyFaces 's "StartupServletContextListener" in, or
> >> out the web.xml. --> Is it necessary?!
> >>
> >> Thanks,
> >> Philippe
> >>
> >>
> >>
> >>
> >>
> >>
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to