You can populate an ActionErrors object in your actionform, or in an action
depending on where you're validating.  You populate the ActionErrors list
with ActionError objects,  so in your form you might

    ActionErrors errors = new ActionErrors();
    errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError(msgKey,arg0,arg1,...));
    return errors;

 If from within an Action,  you'd do the the same, exception you wouldn't
return it, you'd save it to the request:

    saveErrors(request,errors);

    Where "request" is the HttpRequest object that was passed to your
action.execute() method.


 You're msgkey would point to a parameterized msg that might look like this:

 The entity {0} you requested is in use by the following other entities {1}

 You might have to do some special processing to make the list of entities
appear as a single parm if the number if variable.


HTH,
Mike Jasnowski

-----Original Message-----
From: Alawadhi, Mona [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 2:28 PM
To: 'Struts Users Mailing List'
Subject: RE: Delete Validation -- with Vector displayed


This is what I have in my JSP already - to validate other fields of the form
bean:
<%--  Error Messages --%>
        <logic:messagesPresent>
                    <Table class="btable">
                    <tr>
                    <td>
                    <bean:message key="errors.header"/>
                    <ul>
                    <html:messages id="error">
                        <li class="sched_input"><bean:write
name="error"/></li>
                    </html:messages>
                    </ul>
                    </td>
                    </tr>
                    </Table>
                    <BR>
                </logic:messagesPresent>

I get those validations/messages from the 'Validate' method in the form bean
along with the applicationResources.properties file.

I have a check for the 'errors' object in my action class.
1. How can I write my delete-validation in a way that does not conflict with
all of the above?
2. you mentioned 'Return an ActionError...'. Where would I return it
to/from? How can I declare a new ActionError and add it to errors??



-----Original Message-----
From: Mike Jasnowski [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 2:10 PM
To: Struts Users Mailing List
Subject: RE: Delete Validation -- with Vector displayed


Return an ActionError with a message parameterized to include the names of
the entities, then on the JSP, render that errors collection.

-----Original Message-----
From: Alawadhi, Mona [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 2:08 PM
To: 'Struts Users Mailing List'
Subject: Delete Validation -- with Vector displayed


Hello Everyone,

I have a 'Delete' button in my JSP (a submit button). As the button is
submitted, a method gets called (from the Action class) to do the following:
1. checks if the field is NOT used by entities 2. Based on 1, either the
field gets deleted, or the field does not get deleted and a Vector of
entities using the field is returned.

How can I validate/ display a message to the user in case the field is used
and cannot be deleted? The error message should also include the entities
using the field (which is a Vector, or a string).


Thank you,

Mona


****************************************************************************
*
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized.

If you are not the intended recipient, any disclosure, copying, distribution
or any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. When addressed to our clients any opinions or advice
contained in this email are subject to the terms and conditions expressed in
the governing KPMG client engagement letter.
****************************************************************************
*


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


****************************************************************************
*
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized.

If you are not the intended recipient, any disclosure, copying, distribution
or any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. When addressed to our clients any opinions or advice
contained in this email are subject to the terms and conditions expressed in
the governing KPMG client engagement letter.
****************************************************************************
*


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to