Bonjour, je viens de créer un formbean comme suit :
et mon fichier struts-config.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 package presentation.str; import java.util.List; import java.util.Vector; import javax.servlet.http.HttpServletRequest; import ma.corporate.planning.metier.Role; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public class RolesForm extends ActionForm { private List<Role> roles = new Vector<Role>(); private String action = ""; private int idRole; private Role role = new Role(); public List<Role> getRoles() { return roles; } public void setRoles(List<Role> roles) { this.roles = roles; } public String getAction() { return action; } public void setAction(String action) { this.action = action; } public int getIdRole() { return idRole; } public void setIdRole(int idRole) { this.idRole = idRole; } public Role getRole() { return role; } public void setRole(Role role) { this.role = role; } public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) { ActionErrors errors = new ActionErrors(); if ((getRole().getNomRole()== null) || ((getRole().getNomRole().length() < 1))) errors.add("nomRole", new ActionError("error.nomrole.vide")); return errors; } }
il m'affiche les erreurs suivantes :
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 <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"> <struts-config> <form-beans> <form-bean name="cfc" type="presentation.str.ClientsForm"/> <form-bean name="cfs" type="presentation.str.ServicesForm"/> <form-bean name="cfr" type="presentation.str.RolesForm"/> </form-beans> <global-forwards> <forward name="VueClient" path="client.page"/> <forward name="addClient" path="ajoutclient.page"/> <forward name="editClient" path="editclient.page"/> <forward name="VueService" path="service.page"/> <forward name="addService" path="ajoutservice.page"/> <forward name="editService" path="editservice.page"/> <forward name="VueRole" path="role.page"/> <forward name="addRole" path="ajoutrole.page"/> <forward name="editRole" path="editrole.page"/> </global-forwards> <action-mappings> <action path="/gestClient" name="cfc" type="presentation.str.ClientsAction" scope="session" validate="false"> </action> <action path="/gestService" name="cfs" type="presentation.str.ServicesAction" scope="session" validate="false"> </action> <action path="/gestRole" name="cfr" type="presentation.str.RolesAction" scope="session" validate="false"> </action> </action-mappings> <message-resources parameter="ApplicationResources"/> <!-- Tiles Configuration --> <plug-in className="org.apache.struts.tiles.TilesPlugin"> <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/> </plug-in> </struts-config>
vous savez d'ou l'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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 16:54:09,484 ERROR RequestUtils:304 - Error creating form bean of class presentation.str.RolesForm java.lang.NullPointerException at org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:212) at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:292) at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:191) at org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor.java:319) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:202) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source) 16:54:09,500 ERROR RequestProcessor:284 - No action instance for path /gestRole could be created java.lang.ClassNotFoundException: presentation.str.RolesAction at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:117) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143) at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:280) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:218) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source)
Partager