IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JSF Java Discussion :

comment configurer spring avec ICefaces


Sujet :

JSF Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Avril 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Avril 2010
    Messages : 20
    Par défaut comment configurer spring avec ICefaces
    salut TLM
    mon environnement :eclipse

    j'ai commencé mon projet d'abord avec spring mais j'ai pas utilisé JSF (seulement des page jsp avec code html) et ca marche formidable

    maintenant depuis une semaine j'arrive pas a configuré spring avec l'utilisation de ICefaces avec le meme projet

    j'ai téléchargé un exemple SPRINcrud mais j'ai pas arrivé a bien configuré

    je utilise Spring /hibernate

    mon dao
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    package dao;
     
    import java.util.List;
     
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
     
    import entites.Technicien;
     
     
    public class Dao implements IDao {
     
    	@PersistenceContext
    	private EntityManager em;
    								//Technicien
     
    	// supprimer une Technicien via son identifiant
    	public void deleteOneTechnicien(String cin) {
    	Technicien technicien = em.find(Technicien.class, cin);
    	if (technicien == null) {
    	throw new DaoException(String.format("Technicien n°[%d] inconnue", cin), 2);
    	}
    	em.remove(technicien);
    	}
     
    	@SuppressWarnings("unchecked")
    	// obtenir toutes les Techniciens
    	public List<Technicien> getAllTechnicien() {
    	return em.createQuery("select t from Technicien t").getResultList();
    	}
     
    	@SuppressWarnings("unchecked")
    	// obtenir les propretaires dont le nom correspond àun modèle
    	public List<Technicien> getAllLikeTechnicien(String modele) {
    	return em.createQuery("select t from Technicien t where t.nom like :modele")
    	.setParameter("modele", modele).getResultList();
    	}
     
    	// obtenir un Technicien via son identifiant
    	public Technicien getOneTechnicien(String cin) {
    	return em.find(Technicien.class, cin);
    	}
     
    	// sauvegarder un Technicien
    	public Technicien saveOneTechnicien(Technicien technicien) {
    	em.persist(technicien);
    	return technicien;
    	}
     
    	// mettre à jour un Technicien
    	public Technicien updateOneTechnicien(Technicien technicien) {
    	Technicien t = em.find(Technicien.class, technicien.getCin());
    	if (t == null) {
    	throw new DaoException(String.format("Technicien n°[%d] inconnue", technicien.getCin()), 2);
    	}
    	return em.merge(technicien);
    	}

    ma couche service

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    package service;
     
    import java.util.List;
     
    import org.springframework.transaction.annotation.Transactional;
     
    import dao.IDao;
     
    import entites.Administrateur;
    import entites.Camion;
    import entites.Chauffeur;
    import entites.ClientFidele;
    import entites.ClientPassager;
    import entites.Compte;
    import entites.Contrat;
    import entites.DemandeVoyage;
    import entites.Entreprise;
    import entites.Message;
    import entites.Individu;
    import entites.Reponse;
    import entites.Technicien;
    import entites.Voyage;
     
    //ttes les méthodes de la classe se déroulent dans une transaction
    @Transactional
    public class Service implements IService {
     
    	// couche [dao]
    	private IDao dao;
     
    	public IDao getDao() {
    		return dao;
    	}
     
    	public void setDao(IDao dao) {
    		this.dao = dao;
    	}
    // supprimer une Technicien via son identifiant
    	public void deleteOneTechnicien(String cin) {
    	  dao.deleteOneTechnicien(cin);
    	}
     
    	// obtenir toutes les Techniciens
    	public List<Technicien> getAllTechnicien(){
    		return dao.getAllTechnicien();
    	}
     
     
    	// obtenir les propretaires dont le nom correspond àun modèle
    	public List<Technicien> getAllLikeTechnicien(String modele) {
    		return dao.getAllLikeTechnicien(modele);
    	}
     
    	// obtenir un Technicien via son identifiant
    	public Technicien getOneTechnicien(String cin){
    		return dao.getOneTechnicien(cin);
    	}
     
    	// sauvegarder un Technicien
    	public Technicien saveOneTechnicien(Technicien technicien){
    		return dao.saveOneTechnicien(technicien);
    	}
     
    	// mettre à jour un Technicien
    	public Technicien updateOneTechnicien(Technicien technicien){
    		return dao.updateOneTechnicien(technicien);
    	}

    la couche web

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    package web;
     
    import java.io.IOException;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.*;
     
     
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.* ;
     
    import net.sf.cglib.proxy.*;
     
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
     
     
    import service.IService;
    import dao.DaoException;
    import entites.*;
     
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
     
     
    public class Tech {
    	private List<Technicien> techniciens;
    	// service
    	private IService service = null;
     
    	public Tech(){
     
    	}
    	// init
     
    	public void init() throws ServletException {
     
    		// configuration de l'application
    		ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config.xml");
    		// couche service
    		service = (IService) ctx.getBean("service");
     
    	}
     
    	public String doListTechnicien(){
     
    		techniciens=service.getAllTechnicien();
    		System.out.println("ggggggggggggggggggg");
    		return "list";
    		}
     
     
     
    	public List<Technicien> getTechniciens() {
    	return techniciens;
    }
     
     
    public void setTechniciens(List<Technicien> techniciens) {
    	this.techniciens = techniciens;
    }
    	}

    et j'ai un fichier spring-config pour configurer spring et hibernate c'est le même que l'ancien projet avant l'utilisation de ICefaces

    sppring-config

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans 
    	http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
    	http://www.springframework.org/schema/tx 
    	http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
     
    	<!-- couches applicatives -->
    	<bean id="dao" class="dao.Dao" />
    	<bean id="service" class="service.Service">
    		<property name="dao" ref="dao" />
    	</bean>
     
    	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    		<property name="dataSource" ref="dataSource" />
    		<property name="jpaVendorAdapter">
    			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    				<!-- 
    					<property name="showSql" value="true" />
    				-->
    				<property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
    				<property name="generateDdl" value="true" />
    			</bean>
    		</property>
    		<property name="loadTimeWeaver">
    			<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
    		</property>
    	</bean>
     
    	<!-- la source de donnéees DBCP -->
    	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    		<property name="driverClassName" value="com.mysql.jdbc.Driver" />
    		<property name="url" value="jdbc:mysql://localhost:3306/jpa" />
    		<property name="username" value="jpa" />
    		<property name="password" value="jpa" />
    	</bean>
     
    	<!-- le gestionnaire de transactions -->
    	<tx:annotation-driven transaction-manager="txManager" />
    	<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    		<property name="entityManagerFactory" ref="entityManagerFactory" />
    	</bean>
     
    	<!-- traduction des exceptions -->
    	<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
     
    	<!-- persistence -->
    	<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
     
    </beans>



    mon fichier web.xml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
      <display-name>exemple</display-name>
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <context-param>
        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
      </context-param>
      <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>resources.application</param-value>
      </context-param>
      <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
      </listener>
      <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.jspx</param-value>
      </context-param>
      <context-param>
        <description>To allow multiple windows for a single application.</description>
        <param-name>com.icesoft.faces.concurrentDOMViews</param-name>
        <param-value>false</param-value>
      </context-param>
      <context-param>
        <description>Turn on/off application-wide synchronous or asynchronous updates.	</description>
        <param-name>com.icesoft.faces.synchronousUpdate</param-name>
        <param-value>false</param-value>
      </context-param>
      <context-param>
        <description>Google Maps API key is required if gMap component is used. Sign up for an API key from http://code.google.com/apis/maps/signup.html</description>
        <param-name>com.icesoft.faces.gmapKey</param-name>
        <param-value>ABQIAAAADlu0ZiSTam64EKaCQr9eTRTOTuQNzJNXRlYRLknj4cQ89tFfpxTEqxQnVWL4k55OPICgF5_SOZE06A</param-value>
      </context-param>
      <context-param>
        <param-name>com.icesoft.faces.uploadDirectory</param-name>
        <param-value>upload</param-value>
      </context-param>
      <context-param>
        <param-name>com.icesoft.faces.uploadMaxFileSize</param-name>
        <param-value>4048576</param-value>
      </context-param>
      <servlet>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>*.iface</url-pattern>
        <url-pattern>*.jspx</url-pattern>
        <url-pattern>/xmlhttp/*</url-pattern>
        <url-pattern>*.faces</url-pattern>
        <url-pattern>*.jsf</url-pattern>
        <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>
      <servlet>
        <servlet-name>Blocking Servlet</servlet-name>
        <servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Blocking Servlet</servlet-name>
        <url-pattern>/block/*</url-pattern>
      </servlet-mapping>
      <servlet>
        <servlet-name>uploadServlet</servlet-name>
        <servlet-class>com.icesoft.faces.component.inputfile.FileUploadServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>uploadServlet</servlet-name>
        <url-pattern>/uploadHtml</url-pattern>
      </servlet-mapping>
      <listener>
        <listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>
      </listener>
    	 
        <servlet>
    	  <servlet-name>SpringContextServlet</servlet-name>
    	  <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>	  
    	  <load-on-startup>1</load-on-startup>
        </servlet>
    </web-app>


    mon fichier face-config

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    <faces-config
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
        version="1.2">
     
    	<!DOCTYPE faces-config PUBLIC
      "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
     
    <faces-config xmlns="http://java.sun.com/JSF/Configuration">-->
     
    	<!DOCTYPE faces-config PUBLIC
            "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
            "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
     
    <faces-config>
     
     
       <managed-bean>
    	<managed-bean-name>tech</managed-bean-name>
    		<managed-bean-class>web.Tech</managed-bean-class>
    		<managed-bean-scope>session</managed-bean-scope>
    	</managed-bean>
     
    	<navigation-rule>
    		<display-name>list</display-name>
    		<from-view-id>/acui.jspx</from-view-id>
    		<navigation-case>
    			<from-outcome>list</from-outcome>
    			<to-view-id>/cherche.jspx</to-view-id>
    			<redirect />
    		</navigation-case>
    	</navigation-rule>
     
         <application>
    		<variable-resolver>
    			org.springframework.web.jsf.DelegatingVariableResolver
    		</variable-resolver>
    		<locale-config />
    	</application>
     
    	<lifecycle />
    	<factory />
    </faces-config>


    merci pour m'aidé

  2. #2
    Membre confirmé
    Inscrit en
    Décembre 2009
    Messages
    68
    Détails du profil
    Informations forums :
    Inscription : Décembre 2009
    Messages : 68
    Par défaut
    essaie d'enlever
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
        <servlet>
    	  <servlet-name>SpringContextServlet</servlet-name>
    	  <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>	  
    	  <load-on-startup>1</load-on-startup>
        </servlet>
    et de mettre à la place
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>/WEB-INF/applicationContext.xml</param-value>
    	</context-param>
    	<context-param>
    		<param-name>javax.faces.CONFIG_FILES</param-name>
    		<param-value>/WEBINF/faces-config.xml</param-value>
    	</context-param>
    je crois que dans ton cas ce n'est pas applicationContext.xml mais spring-config
    et puis essaie aussi de réorganiser ton web.xml
    1-context-param
    2-listener
    3-Servlet
    4-servlet-mapping
    5-session-config
    6-welcome-file-list

  3. #3
    Membre averti
    Inscrit en
    Avril 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Avril 2010
    Messages : 20
    Par défaut
    merci soffru

    mais c'est la meme chose et le meme erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    java.lang.NullPointerException
    	web.Tech.doListTechnicien(Tech.java:39)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	java.lang.reflect.Method.invoke(Method.java:597)
    	org.apache.el.parser.AstValue.invoke(AstValue.java:172)
    	org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    	com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    	com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    	javax.faces.component.UICommand.broadcast(UICommand.java:387)
    	javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
    	javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
    	com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
    	com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    	com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
    	com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:132)
    	com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:74)
    	com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:31)
    	com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
    	com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
    	com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
    	com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
    	com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:26)
    	com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
    	com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:131)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java

  4. #4
    Membre confirmé
    Inscrit en
    Décembre 2009
    Messages
    68
    Détails du profil
    Informations forums :
    Inscription : Décembre 2009
    Messages : 68
    Par défaut
    tu peux mettre la liste de jars que t'utilises

  5. #5
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 16
    Par défaut
    Hello,

    A quoi correspond la ligne 39 dans ton Tech.java?

    Ta manière de faire n'est pas "très propre". Plutot que de charger le context spring depuis le code, généralement on le fait via le fichier web.xml. D'abord en déclarant un listenet spring:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    <!--spring listener-->
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    Ensuite, dans le même fichier web.xml, tu donnes le chemin vers tes fichiers de contexte spring. Par exemple dans ton cas (si j'ai bien suivi):

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    <!--spring configuration-->
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			classpath:spring-config.xml
    		</param-value>
    	</context-param>
    Ensuite tu peux injecter ton service java via ton fichier faces-config.xml. Il faut commencer à dire à JSF d'utiliser le resolver de Spring. Ca se fait en rajoutant ceci dans la section Application de ton fichier faces-config.xml:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>

    N'oublie pas de creer un getter et setter dans ton Tech.java pour ta propriété service. Puis tu injectes ton objet Tech dans ton managed bean JSF, via le fichier faces-config

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <managed-bean-name>tech</managed-bean-name>
    		<managed-bean-class>web.Tech</managed-bean-class>
    		<managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    			<property-name>service</property-name>
    			<value>#{service}</value>
    		</managed-property>
    </managed-bean>

  6. #6
    Membre averti
    Inscrit en
    Avril 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Avril 2010
    Messages : 20
    Par défaut
    les JAR que j'utilise sont :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    /exemple/WebContent/WEB-INF/lib/antlr-2.7.6.jar
    asm.jar
    asm-attrs.jar
    backport-util-concurrent.jar
    c3p0-0.9.0.jar
    cglib-2.1.3.jar
    commons-beanutils.jar
    commons-collections.jar
    commons-collections-2.1.1.jar
    commons-digester.jar
    commons-discovery.jar
    commons-el.jar
    commons-fileupload.jar
    commons-lang.jar
    commons-logging.jar
    commons-logging-1.0.4.jar
    dom4j-1.6.1.jar
    ejb3-persistence.jar
    hibernate3.jar
    hibernate-annotations.jar
    hibernate-entitymanager.jar
    hibernate-tools.jar
    icefaces.jar
    icefaces-comps.jar
    javassist.jar
    jboss-archive-browsing.jar
    jsf-api-1.2.jar
    jsf-impl-1.2.jar
    jta.jar
    spring.jar


    et concernant la ligne 39 c'est la ligne



    techniciens=service.getAllTechnicien();


    et l'erreur comme si techniciens est de valeur null

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [CKEditor] Comment configurer l'éditeur avec une url
    Par whitespirit dans le forum Bibliothèques & Frameworks
    Réponses: 5
    Dernier message: 12/06/2008, 11h00
  2. [CS3] Comment configurer Wamp avec Dreamweaver ?
    Par riton78 dans le forum Dreamweaver
    Réponses: 3
    Dernier message: 12/01/2008, 16h13
  3. Réponses: 0
    Dernier message: 27/07/2007, 10h26
  4. Comment configurer un BindingSource avec une liaison
    Par Alexandre` dans le forum Accès aux données
    Réponses: 3
    Dernier message: 18/10/2006, 14h34

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo