Hi Thomas
Here what I would do.

struts-config.xml:

       <action    path="/logon/action/logon"
                  type="test.web.struts.action.logon.LogonAction"
                  name="logonForm"
                 scope="request"        <-- !!!
              validate="false"          <-- !!!
                 input="/WEB-INF/jsp/logon/logon.jsp">
            <forward   name="success"   path="/index.jsp"/>
       </action>

LogonAction.java:

  ActionErrors errors = new ActionErrors();
  errors = form.validate(mapping, request);

  // Report any errors we have discovered back to the original form
  if (!errors.isEmpty())
  {
      saveErrors(request, errors);
      return  new ActionForward(mapping.getInput());
  }


And be sure that your Class extends DynaValidatorForm. Hope this helps Koni



thomas Sontheimer wrote:
I'm attempting to use the validator with a DynaValidatorForm and it
returns a blank page if I don't fill the field.
And if I fill the username field I'm redirected to the good page
(/index.jsp).

any idea?

thomas

here are some parts from my code:

struts-config.xml:

          <form-bean
            name="logonForm"
            type="org.apache.struts.validator.DynaValidatorForm">
            <form-property name="username" type="java.lang.String"/>
            <form-property name="password" type="java.lang.String"/>
          </form-bean>

          <action    path="/logon/action/logon"
                     type="test.web.struts.action.logon.LogonAction"
                     name="logonForm"
                     scope="session"
                     input="/WEB-INF/jsp/logon/logon.jsp">
                     <forward   name="success"   path="/index.jsp"/>
          </action>


validation.xml:


    <formset>
       <form name="logonForm">
          <field property="username" depends="required">
             <arg0 key="logon.data.username"/>
          </field>
       </form>
    </formset>


logon.jsp:


    <body>
    <html:errors/>
    <html:form action="/logon/action/logon.do" focus="username">
    <table border="0" width="100%">
      <tr>
        <th align="right">
          Username:
        </th>
        <td align="left">
          <html:text property="username"/>
        </td>
      </tr>
      <tr>
        <th align="right">
          Password:
        </th>
        <td align="left">
          <html:password property="password"/>
        </td>
      </tr>
      <tr>
        <td align="right">
          <html:submit property="submit" value="Submit"/>
        </td>
        <td align="left">
          <html:reset/>
        </td>
      </tr>
    </table>
    </html:form>
    </body>


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to