Bonjour,
je souhaiterais intégrer mes beans Spring(IService...) dans mes Actions de Struts.
J'ai lu l'explication sur developpez.com qui dit de rajouter ça dans struts-config.xml:
Code:
1
2
3
4 <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/action-servlet.xml.xml,/WEB-INF/applicationContext.xml"/> </plug-in>
Code:
1
2
3
4 <controller> <set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/> </controller>
Comme je travaille avec Eclipse, je ne possède pas les fichiers :
action-servlet.xml.xml et applicationContext.xml.
Que dois-je faire?
Pour le moment, j'ai toujours l'erreur suivante:
La servlet action est actuellement indisponible
Voici mon fichier: Spring-config.xml
Mon fichier struts-config.xmlCode:
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- 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</value> </property> <property name="url"> <value>jdbc:mysql://localhost/enduro_db</value> </property> <property name="username"> <value>root</value> </property> <property name="password"> <value></value> </property> </bean> <!-- sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource"/> </property> <property name="configLocation"> <value>hibernate.cfg.xml</value> </property> </bean> <!-- la classes d'accès à la couche [dao] --> <bean id="daoEnduro" class="com.enduro.dao.DaoEnduro"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="daoPrise" class="com.enduro.dao.DaoPrise"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <!-- la classe serviceEnduro --> <bean id="serviceEnduro" class="com.enduro.service.ServiceEnduro"> <property name="daoEnduro"> <ref local="daoEnduro" /> </property> </bean> <!-- la classe servicePrise --> <bean id="servicePrise" class="com.enduro.service.ServicePrise"> <property name="daoPrise"> <ref local="daoPrise" /> </property> </bean> <!-- Les controleurs <bean id="/ListEnduro" class="com.enduro.ui.ListEnduroAction"> <property name="serviceEnduro"> <ref local="serviceEnduro" /> </property> </bean> --> </beans>
J'ai fait un essai seulement pour /ListEnduroCode:
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <data-sources/> <form-beans> <form-bean name="GetEnduroForm" type="com.enduro.ui.GetEnduroForm"/> <form-bean name="GetNouvellePeseeForm" type="com.enduro.ui.GetNouvellePeseeForm"/> <form-bean name="GetNouvelleEquipeForm" type="com.enduro.ui.GetNouvelleEquipeForm"/> </form-beans> <global-exceptions/> <global-forwards/> <action-mappings> <action name="GetEnduroForm" path="/NouveauEnduro" scope="request" type="com.enduro.ui.NouveauEnduroAction"> <forward name="index" path="/NouvelleEquipe.jsp"/> </action> <action name="GetNouvellePeseeForm" path="/NouvellePesee" scope="request" type="com.enduro.ui.NouvellePeseeAction"> <forward name="index" path="/NouvellePesee.jsp"/> </action> <action name="GetNouvelleEquipeForm" path="/NouvelleEquipe" scope="request" type="com.enduro.ui.NouvelleEquipeAction"> <forward name="index" path="/NouvelleEquipe.jsp"/> </action> <action path="/ListEnduro" scope="request" type="com.enduro.ui.ListEnduroAction"> <forward name="index" path="/ListEnduro.jsp"/> </action> <action path="/ChargerEnduro" scope="request" type="com.enduro.ui.ChargerEnduroAction"> <forward name="index" path="/index.jsp"/> </action> </action-mappings> <!-- <set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/> --> <controller/> <message-resources null="false" parameter="Resources_fr"/> <!-- <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/action-servlet.xml.xml,/WEB-INF/applicationContext.xml"/> </plug-in> --> </struts-config>
Je prends toutes vos idées
Merci