Hi :

IMHO, JSF uses the faces-config.xml to do the wiring and configuration:

( here is one example from the manning -- great books written by struts
expert -- spring2 in action  )

Say your jsf has form :

<h:form>
  <h2>Register Motorist</h2>
  <h:panelGrid columns="2">
     <f:verbatim><b>E-mail</b></f:verbatim>
     <h:inputText value="#{motorist.email}" required="true" />
      .....

  </h:panelGrid>
  <h:commandButton id="submit" action="#{motorists.register}"
       value="Register Motorists" />
</h:form>

Model / JSF's managed bean is : Motorists

b. I notice also that JSF differs with other frameworks on specifying the
action
    jsf include the bean's method as the parameter in the action

  The register() method is something like :

   public String register(){
    try{
     rantService.addMotorists(this) ;

    }catch{ }

   }
   return "success" ;
   }

 c. The rantServices is then being configured in faces-config.xml :

   <managed-bean>
     <managed-bean-name>motorist</managed-bean>
      <managed-bean-class>com.roadrantz.domain.Motorist</man.....>
      <managed-bean-scope>request</man....>
      <managed-bean-property>
       <property-name>rantService</property-name>
       <value>#{rantService}</value>
        </managed-bean-property>
    </managed-bean>

      The config for rantService is

   <managed-bean>
     <managed-bean-name>rantService</managed-bean>
      <managed-bean-class>com.roadrantz.service.RantServiceImpl</man.....>
      <managed-bean-scope>session</man....>
      <managed-bean-property>
       <property-name>rantDao</property-name>
       <value>#{rantDao}</value>
        </managed-bean-property>
    </managed-bean>

    etc all the way to confugration of Datasource ( similar like Springbeans
config right ? )

d. So in order for JSF aware of the spring context then we just need
  to put inside the faces-config.xml :

   <application>

<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
    </application>

   The DelegatingVariableResolver is sitting and waiting in the context

 Notes : we also need to configure the web.xml the ContextLoaderListener
which to trigger the Spring container and produce the
DelegatingVariableResolver

e. The logic is : When it comes to inject the rantService property, the
container

is asking the DelegatingVariableResolver for the reference of rantService

bean, the the DelegatingVariableResolver will look in the JSF config (
faces-

config.xml ) first ! and if it can not find, then it will look at spring
application

context ( spring config )

f. We are free to jot down the rantService as spring bean :

<bean id="rantService" class="com.roadrantz.service.RantServiceImpl" >
   <property name="rantDao" ref="rantDao" />
 </bean>

  We are handling the control to the Spring container !


Hope it will help


cheers

bb



On Mon, Mar 8, 2010 at 6:17 AM, Mansee Mongia
<manseemon...@gmail.com> wrote:

> Hi
> Why dont you try these links as follows:
> http://www.javabeat.net/articles/39-integrating-spring-and-jsf-1.html
> http://cagataycivici.wordpress.com/2005/12/25/integrating_jsf_and_spring/
>
>
>
> 2010/3/7 aykut kanyılmaz <onbira...@gmail.com>
>
> hi, i dont do integrate spring with jsf. i research it very much, but it
>> didnt. can you help me with sample code ?
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Java EE (J2EE) Programming with Passion!" group.
>> To post to this group, send email to
>> java-ee-j2ee-programming-with-passion@googlegroups.com
>> To unsubscribe from this group, send email to
>> java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com<java-ee-j2ee-programming-with-passion%2bunsubscr...@googlegroups.com>
>> For more options, visit this group at
>>
>> http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
>
>
>
>
> --
> Mansee Mongia
>
> Have an awesome day!! :=)
> "We will either find a way, or make one!"- Hannibal
>
>
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Java EE (J2EE) Programming with Passion!" group.
> To post to this group, send email to
> java-ee-j2ee-programming-with-passion@googlegroups.com
> To unsubscribe from this group, send email to
> java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com<java-ee-j2ee-programming-with-passion%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
>
> http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to