Solved

ActionErrors + return message

Posted on 2004-04-29
3
245 Views
Last Modified: 2010-04-01
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="com.srl.SomeAction" name="loginForm" parameter="method" scope="request" >
       <forward name="success" path="/pages/resultPage.jsp"/>
       <forward name="failure" path="/pages/login.jsp"/>
    </action>
0
Comment
Question by:MissBrucoMela
  • 2
3 Comments
 

Author Comment

by:MissBrucoMela
ID: 10949849
I forget...Don't work in this way
0
 
LVL 35

Accepted Solution

by:
TimYates earned 125 total points
ID: 10957219
what happens?  any exceptions?
0
 

Author Comment

by:MissBrucoMela
ID: 10959425
Happens nothing. No error message. What can I do?
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
A Short Story about the Best File Recovery Software – Acronis True Image 2017
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now