Hi

In you mapping you have : input="/com/mbresearch/main/view/signin.jsp" -
This is where it will go if something goes wrong.

Hermod

-----Opprinnelig melding-----
Fra: Ray Madigan [mailto:[EMAIL PROTECTED]
Sendt: 7. april 2004 20:03
Til: Struts-User
Emne: Struts Form Validation


I have a problem that I cannot see why it behaves the way it does, and
was
hoping a couple more eyeballs might help, thanks!

I have a jsp that has

<html:errors/>

<html:form action='/signin' focus='username'>

A couple of input controls including username

</html:form>

When the user types in all of the fields correcly this work fine.
The execute method of action signin is called and all is well.

When the user doesn't fill in one of the fields is when the problem
shows
itself.

The action looks like this

    <action path="/signin"
            type="com.mbresearch.main.action.SigninAction"
            name="signinForm"
            scope="session"
            input="/com/mbresearch/main/view/signin.jsp">
      <exception
         key="credential.exception"
         type="com.mbresearch.registrar.ejb.InvalidCredentialException"
         path="/com/mbresearch/main/view/icexcept.jsp"/>
      <exception
         key="system.exception"
         type="com.mbresearch.xrm.ejb.InvalidSystemException"
         path="/com/mbresearch/main/view/isexcept.jsp"/>

    </action>

When the user doesn't fill in the form correctly, the validate method of
the
form is executed, and the page that is displayed is at URL

/signin.do

and not the input page as I thought was to happen, based on the doc.

The validate method look like this!

public final class SigninForm
extends ActionForm {

    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();
        if ((username == null) || (username.length() < 1))
            errors.add("username", new
ActionError("error.username.required"));
        if ((password == null) || (password.length() < 1))
            errors.add("password", new
ActionError("error.password.required"));
        return errors;
    }

Any help would be greatly appreciated!


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


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that DnB NOR cannot
accept any payment orders or other legally binding correspondence with
customers as a part of an email. 

This email message has been virus checked by the virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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

Reply via email to