Bonjour
j ai un petit soucis avec la dispatchAction en fait a chaque fois ou j accede a la page qui contient le parametre operation elle me ressort une erreur du type
voila mon codeServlet error: Request[/operations] does not contain handler parameter named 'operation'. This may be caused by whitespace in the label text.
Struts-config
OperationsForm
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 <action path="/operations" type="com.frsq.registre.web.action.investigator.OperationsAction" name="operationsForm" scope="request" validate="true" parameter="operation" > <forward name="succes" path="/operations" redirect="false"/> </action>OperationsAction
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 public class OperationsForm extends ActionForm{ private String operation="aucune"; private String reference; public void setOperation(String operation) { this.operation = operation; } public String getOperation() { return operation; } public void setReference(String reference) { this.reference = reference; } public String getReference() { return reference; } }Page operations.jsp
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 public class OperationsAction extends DispatchAction { public ActionForward ajouter( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("Appel de la methode ajouter()"); return (mapping.findForward("succes")); } public ActionForward modifier( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("Appel de la methode modifier()"); return (mapping.findForward("succes")); } public ActionForward supprimer( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("Appel de la methode supprimer()"); return (mapping.findForward("succes")); } }
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 <%@ page contentType="text/html;charset=windows-1252"%> <%@ taglib uri="/WEB-INF/config/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/config/struts-html.tld" prefix="html" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/> <title>untitled</title> </head> <body> <html:form action="/operations" focusIndex="reference"> <table> <tr> <td> <html:text property="reference"/> </td> </tr> <tr> <td colspan="2" align="center"> <html:submit property="operation">ajouter</html:submit> <html:submit property="operation">modifier</html:submit> <html:submit property="operation">supprimer</html:submit> </td> </tr> </table> </html:form> </body> </html>
Partager