In your catch block, I see this:
validationExc.mapError(errors);
getContext().addError(validationExc.getMessage());
The definition for ValidationException#mapError(ValidationErrors) shows that
it adds the error to the ValidationErrors. I don't know what
YourActionBeanContext#addError(String) does, but based on the name I would
guess it also adds an error to the ValidationErrors.
-Ben
On Tue, Mar 22, 2011 at 10:53 AM, Savoy, Melinda <
melindasa...@texashealth.org> wrote:
> In my validator class I am throwing a ValidationError here:
>
> [code]
> if (valueAdd.hasNEC(req.getNecCode())) {
> throw new ValidationException("nonStockReq.necCode",
> "necExclusion");
> }
> [/code]
>
> In my AbstractRequisitionActionBean I am catching the error:
>
> [code]
> catch (ApplicationException e) {
> ValidationException validationExc = (ValidationException) e;
> validationExc.mapError(errors);
> getContext().addError(validationExc.getMessage());
> log.warn("FAILED APPROVE VALIDATION - {P}", e.getMessage());
> }
> [/code]
>
> In my ValidationException:
>
> [code]
> public class ValidationException extends ApplicationException {
>
> private static final long serialVersionUID = 8320536340453121195L;
>
> private final String fieldName;
>
> public ValidationException(final String fieldName, final String
> message) {
> super(message);
> this.fieldName = fieldName;
> }
>
> public ValidationException(final String fieldName, final String
> msgId, final Object... msgParams) {
> super(msgId, msgParams);
> this.fieldName = fieldName;
> }
>
> @Override
> public void mapError(final ValidationErrors errors) {
> errors.add(fieldName, new SimpleError(getMessage()));
> }
>
> }
> [/code]
>
> And in the ApplicationException that is the superclass for
> ValidationException:
>
> [code]
> public void mapError(final ValidationErrors errors) {
> errors.addGlobalError(new SimpleError(getMessage()));
> }
> [/code]
>
> I am not all sure WHY the error is being duplicated in my JSP page. I’m
> sure it’s something stupid I’m doing I just can see it. Any
> suggestions/direction would be appreciated.
>
> Thanks.
>
> Melinda Savoy
> Sr. Programmer Analyst, ERP Systems
> *I*nnovative *T*echnology *S*olutions
> Texas Health Resources
> 600 E. Lamar Blvd, Ste 301, Arlington TX 76011
> *melindasa...@texashealth.org* <melindasa...@texashealth.org>
>
> *Texas Health Resources: Arlington Memorial,*
> *Harris Methodist and Presbyterian Hospitals*
> *A shared mission and now a shared name.*
>
>
>
>
> The information contained in this message and any attachments is intended
> only for the use of the individual or entity to which it is addressed, and
> may contain information that is PRIVILEGED, CONFIDENTIAL, and exempt from
> disclosure under applicable law. If you are not the intended recipient, you
> are prohibited from copying, distributing, or using the information. Please
> contact the sender immediately by return e-mail and delete the original
> message from your system.
>
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users