Hi Marco, 
I have quickly looked at it, but the exampe-ZIP provided with it, issues such a bunch of configuration files that my initial enthusiasm quickly cooled off. :-(
So, 
1/ What would it take to use this (apart from adding the lib in web-inf/lib :-) (if you don't mind, could you make a summary as I did for the Spring - JSF integration? I've seen the question pass by on this list but nowhere a consise, clear stepwise approach for this integration. Also there is a strange total lack of doc of this Sourceforge project)

2/ What added value does it have compared to regular integration? (i.e. what can I do more?)

 & Another question: what effect would it have (current setup) if I add to my Spring config, the classes used as JSF beans? Which injection would happen first? And would it have any side effects?
Currently I only have JSF beans having managed props in the faces-config.xml, not the other way around.

Thanks, 
Philippe

On 02 Apr 2006, at 17:35, Marco Mistroni wrote:

Hello,
  you might want to try jsf-spring project (it's a sourceforge project), it integrates the two framework just fine
i m currently using it, and it work just fine

hth
 marco

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







Reply via email to