Solved

ActionErrors + return message

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
attribute vs parameter and setter vs add method 17 86
report generation frameworks 1 64
Using Tomcat as raspberry pi java app server 13 166
Suggestion on WebSite Template Sites 6 101
This article outlines why you need to choose a backup solution that protects your entire environment – including your VMware ESXi and Microsoft Hyper-V virtualization hosts – not just your virtual machines.
This problem is more common than not and I will show you some things to check to solve this problem.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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