Bonjour,

Je suis débutant en struts et me voici confronté à mon premier problème !

A partir d'un formulaire je souhaite appeler 2 actions différentes d'une même classe.
Pour mon test, dans ma jsp, j'ai un seul boutton submit qui appel ma première méthode. Quand je test, cela fonctionne correctement. Voici la ligne pour les valeurs tests:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
<html:submit onclick="setHidden(processreponse);" >Rep</html:submit>
Quand je change juste le nom de la métode à appeler, impossible d'atteindre ma jsp formulaire, une erreur ce produit
Voici la ligne pour les valeurs tests:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
<html:submit onclick="setHidden('processother');" >Rep</html:submit>
Voici l'erreur:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
type Rapport d'état
 
message /test2-strutsperson2-1.0.0-SNAPSHOT/formulaire.do
 
description La ressource demandée (/test2-strutsperson2-1.0.0-SNAPSHOT/formulaire.do) n'est pas disponible.
Mon strutc 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
 
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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>
	<form-beans>
		<form-bean name="frmPersonne" type="be.FormulaireBean" />
	</form-beans>
 
	<action-mappings>
 
		<action parameter="/WEB-INF/vues/reponse.personne.jsp"
			path="/reponse" type="org.apache.struts.actions.ForwardAction" />
 
		<action parameter="/WEB-INF/vues/formulaire.personne.jsp"
			path="/formulaire" type="org.apache.struts.actions.ForwardAction" />
 
		<action parameter="/WEB-INF/vues/other.jsp" path="/other"
			type="org.apache.struts.actions.ForwardAction" />
 
		<action parameter="/WEB-INF/vues/erreurs.personne.jsp"
			path="/erreurs" type="org.apache.struts.actions.ForwardAction" />
 
		<action path="/main" name="frmPersonne" scope="request"
			validate="true" parameter="hidden" type="be.FormulaireAction">
 
			<forward name="reponse" path="/reponse.do" />
			<forward name="other" path="/other.do" />
		</action>
	</action-mappings>
 
	<message-resources parameter="personnesresources" />
</struts-config>
Ma jsp qui fonctionne une fois sur deux:
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
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
<meta http-equiv="pragma" content="no-cache">
<head>
<title>Personne - formulaire</title>
<script language="javascript">
function effacer(){
with(document.frmPersonne){
nom.value="";
age.value="";
}
}
   function setHidden(value){document.formulaire.hidden.value=value;
   document.formulaire.submit();
   }
</script>
</head>
<body>
<center>
<h2>Personne - formulaire</h2>
<hr>
<html:form action="/main">
<html:hidden property="hidden" value="processother"/>
	<table>
		<tr>
			<td>Nom</td>
			<td><html:text property="nom" size="20" /></td>
		</tr>
		<tr>
			<td>Age</td>
			<td><html:text property="age" size="3" /></td>
		</tr>
		<tr>
	</table>
	<table>
		<tr>
			<td><html:submit onclick="setHidden('processother');" >Rep</html:submit> (La ligne de code qui fonctione quand elle le souhaite)</td>
			<td><html:reset value="Rétablir" /></td>
			<td><html:button property="btnEffacer" value="Effacer"
				onclick="effacer()" /></td>
		</tr>
	</table>
	

</html:form></center>
</body>
</html>
Mon Action:

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
 
package be;
 
import java.io.IOException;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
 
 
public class FormulaireAction extends DispatchAction {
 
	 public ActionForward processreponse(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
	        // on a un formulaire valide, sinon on ne serait pas arrivé là
	        FormulaireBean formulaire = (FormulaireBean) form;
	        request.setAttribute("nom", formulaire.getNom());
	        request.setAttribute("age", formulaire.getAge());
 
	        return mapping.findForward("reponse");
	    }
    public ActionForward processother(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        // on a un formulaire valide, sinon on ne serait pas arrivé là
        FormulaireBean formulaire = (FormulaireBean) form;
        request.setAttribute("nom", formulaire.getNom());
        request.setAttribute("age", formulaire.getAge());
 
 
        return mapping.findForward("other");
    }
 
}
Je ne met pas mon bean car avec un forward normal il fonctionne parfaitement.

Savez vous ou est mon erreur ? Pourquoi le dispatchAction ne fontionne pas dans les 2 cas ?

Merci pour votre aide !