Solved

ActionErrors + return message

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
method inner class 6 81
report generation frameworks 1 60
reflections, dynamic class loading 3 66
how to exclude a file using regex 5 117
When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
With the rapid rise in mobile usage, mobile devices are here to stay and have become an integral part of doing business. Here are 9 great apps for your BYOD environment.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

15 Experts available now in Live!

Get 1:1 Help Now