Bonjour,

Nous souhaitons utiliser plusieurs actions dans un formulaire avec le DispatchAction mais cela ne fonctionne pas.

A l'exécution de notre JSP, nous obtenons le message :
message Request[/lotsAdmin] does not contain handler parameter named dispatch
description La requête envoyée par le client était syntaxiquement incorrecte (Request[/lotsAdmin] does not contain handler parameter named dispatch).

Pouvez-vous nous aider ?
Merci

Nous avons mis dans la JSP adminLots.jsp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
function setDispatch(value){			document.LotsForm.dispatch.value=value;}
...
<html:form action="/lotsAdmin" method="POST">
    <html:hidden property="dispatch" value="initial"/>
    <html:submit onclick="setDispatch('liste');">Liste</html:submit>
</html:form>
Dans le struts-config :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 <form-bean       name="LotsForm"
                     type="fr.sod.mig.work.web.LotsForm">
</form-bean>
 
<action    path="/lotsAdmin"
               input="/adminLots.jsp"
               type="fr.sod.mig.work.web.LotsAction"
               name="LotsForm"
               scope="request"
               validate="false"
               parameter="dispatch">
      <forward name="succes"             path="/adminLots.jsp"/>
</action>
Et dans la classe 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
public class LotsAction extends DispatchAction
{
    public LotsAction()
    {        super();}
 
    public ActionForward liste(
        ActionMapping       mapping,
        ActionForm          form,
        HttpServletRequest  request,
        HttpServletResponse response)
        throws Exception
    {
    	System.out.println ("coucou");
        return mapping.findForward("succes");
    }
   public ActionForward initial(
            ActionMapping       mapping,
            ActionForm          form,
            HttpServletRequest  request,
            HttpServletResponse response)
            throws Exception
        {
        	System.out.println ("coucou2");
            return mapping.findForward("succes");
        }