In order to have multiple actions on one form, I use dispatchAction. I'm starting with a lonely action which works when I use standard action with execute method. Before adding several action I start to convert this one.
At first load of the jsp, before any submit, I get the error :
Error 400: Request[/rechercheUtilisateur] does not contain handler parameter named hidden
Here is my configuration :
struts-config :
<action path="/rechercheUtilisateur" type="lan.poujoulat.osac.actions.RechercheUtilisateurAction" name="formRechercheUtilisateur" validate="true" input="/Administration/acces.jsp" scope="request" parameter="hidden">
<forward name="réussiteRecherche" path="/Administration/acces.jsp">
</forward>
jsp Administration/acces.jsp :
<SCRIPT>
function setHidden(value){document.formRechercheUtilisateur.hidden.value=value;}
</SCRIPT>
<html:form action="/rechercheUtilisateur"
name="formRechercheUtilisateur"
type="lan.poujoulat.osac.forms.FormRechercheUtilisateur">
...
<td align="center" width="80"><a href="#"
title='"Rechercher" />'> <input type=image
value=submit src="./image/btnRech.gif" width="22" height="20"
border="0" onclick="setHidden('recherche');"> </a></td>
</a>
...
<html:hidden property="hidden" value="recherche"/>
</html:form>
RechercheUtilisateurAction.java :
public class RechercheUtilisateurAction extends DispatchAction
{
public ActionForward recherche(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
I add the hidden property to my form :
public class FormRechercheUtilisateur extends ValidatorForm
{
...
private String hidden = " ";
...