struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yansheng Lin" <>
Subject RE: Validation question
Date Mon, 28 Jul 2003 19:58:50 GMT

errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.userNotFound",

-----Original Message-----
From: Bailey, Shane C. [] 
Sent: July 28, 2003 1:37 PM
Subject: Validation question


I have been using the validator plug-in so long now that I can't remember
how this simple thing works:


In an action I determine that the user (as described in a request parameter)
is not in the DB so I want to return an error message to the user

with the username they entered incorrectly.  Here is a code snipet:


Action code:


    public ActionForward execute(ActionMapping mapping,

                                 ActionForm form,

                                 HttpServletRequest request,

                                 HttpServletResponse response)

        throws Exception {


                        String nameOfUserToUpd =


                        DynaActionForm editUserForm = (DynaActionForm)form;


                        UpdateUserSession updSession = new

                        User user = updSession.getUser();




                                    //Add error

                                    errors.add("userName", new

                                    saveErrors(request, errors);


                                    //Set the form variable because the
username came in from a "GET" not a "POST".









properties file:

errors.userNotFound='{0}' was not found.


On the page mapped to "userNotFound" it displays as:    '{0}' was not found


I thought by having the first parameter to errors.add() with the same name
as an attribute on the form bean it would automatically fill in '{0}' ????

This is way past validation and has nothing to do with what is in
validation.xml so I can't specify arg0 value.


How do I accomplish what I am trying to do?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message