ActionErrors + return message

In my Action class execute method, I save an field from the user's form (login.jsp), if for any reason there is a problem such as a empty field or no valid field I want to report details back to the user so they can correct .
Something like
ActionErrors errors = new ActionErrors();
        if ((campo2 == null) || (campo2.length() < 1))
        errors.add("campo2", new ActionError("error.campo2.required"));

        if (!errors.empty())
        return mapping.findForward("failure");

In user's form (login.jsp) I have the follow code:
<html:text property="campo2" value=""/>
<html:errors property="campo2"/>

In the bundle resource I have :

error.campo2.required=Campo2 obbligatorio

In the struts-config.xml , I have :

<action path="/login" type="" name="loginForm" parameter="method" scope="request" >
       <forward name="success" path="/pages/resultPage.jsp"/>
       <forward name="failure" path="/pages/login.jsp"/>
Who is Participating?
TimYatesConnect With a Mentor Commented:
what happens?  any exceptions?
MissBrucoMelaAuthor Commented:
I forget...Don't work in this way
MissBrucoMelaAuthor Commented:
Happens nothing. No error message. What can I do?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.