Alexandre,

The input attribute must be added to the action mapping as follows:

<action path="/requete"
              type="com.sopra.etudestruts.jdbcstandard.RequeteAction"
            name="requeteForm"
           scope="request"
              input="/requete.jsp"
        validate="true">
    <forward name="succes" path="/succes.jsp" />
    <forward name="echec" path="/echec.jsp" />
</action>

where the "input" attribute should contain the name of the JSP you use to
input for the requete action (I assumed it to be '/requete.jsp').

Regards,
Guus
----- Original Message -----
From: "DUPRAT Alexandre" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 20, 2001 11:00
Subject: RE: Validating a form


Hi agian,
Excuse me for being late in my response but i'm currently between too
projects...

Craig, when you say :
"Note that you *must* specify an input attribute on your <Action>, so that
Struts knows where to send the user back to."

What do i need to do, what is the name of this input attribute?
Do you have an example of struts-config.xml code matching the case.

Here is mine:
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";>

<struts-config>

    <form-beans>
        <form-bean name="requeteForm"
                   type="com.sopra.etudestruts.jdbcstandard.RequeteForm"/>
    </form-beans>

    <action-mappings>
     <action path="/requete"

type="com.sopra.etudestruts.jdbcstandard.RequeteAction"
         name="requeteForm"
              scope="request"
           validate="true">
    <forward name="succes" path="/succes.jsp" />
    <forward name="echec" path="/echec.jsp" />
     </action>
    </action-mappings>
</struts-config>


I beleve there is something missing in the action node, but what?
Perhaps struts does not know what page to display when finding errors. How
can i tell it where to go? (another forward???)

Thanks for help.


-----Message d'origine-----
De: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Date: lundi 6 août 2001 18:35
À: '[EMAIL PROTECTED]'
Objet: Re: Validation a form




On Mon, 6 Aug 2001, DUPRAT Alexandre wrote:

> hi,
>
> How can i validate a form?
> I tried :
> public ActionErrors validate(ActionMapping mapping, HttpServletRequest
req)
> {
> ActionErrors errors= new ActionErrors();
> if(! getSqlQuery().startsWith("select")){
> ActionError error = new ActionError("error.requete");
> errors.add("sqlQuery", error);
> }
> return errors;
> }
>
> it works when there is no error but not when i've one....
> Is there somebody with an idea?
>

The above code looks OK -- what about it doesn't work?

Note that you *must* specify an input attribute on your <Action>, so that
Struts knows where to send the user back to.

> Alexandre Duprat
> SOPRA. Direction France Sud. Bordeaux
> [EMAIL PROTECTED]
>

Craig McClanahan


+----------------------------------------------------------------+
| Ce courrier ainsi que les fichiers joints sont confidentiels.  |
| Si vous avez recu ce courrier par erreur, veuillez en informer |
| l'administrateur du systeme : [EMAIL PROTECTED]               |
|                          ---------                             |
| Ce message confirme que le courrier a passe le controle        |
| antivirus du relais de messagerie Internet avec succes.        |
+----------------------------------------------------------------+


Reply via email to