Solved

ActionErrors + return message

Posted on 2004-04-29
3
249 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
object methods vs static methods 2 100
SimpleDateFormat.parse examples 19 98
iterator/ListIterator approach 17 39
collection output issue 9 36
Is your phone running out of space to hold pictures?  This article will show you quick tips on how to solve this problem.
Starting your own business is always a daunting process, and for most people it is brand new experience. Avoid the common pitfalls by following these tips to start on the road to success.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 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