[EMAIL PROTECTED] wrote:
I am trying to display error message in JSp page using the following:
<html:errors property="invalidDate" />

The code in my validate method is:
errors.add("invalidDate", new ActionMessage( endDate + " must be greater
than " + startDate ));
return errors;

Any clue whats wrong?
Couple things:

1) Try using this constructor instead:

ActionMessage( String key, boolean resource);
So you'd use it like this:
errors.add( "dateProperty", new ActionMessage( endDate + " must be greater than " + startDate, false ) ); // note the false at the end

2) Notice I said "dateProperty" instead of "invalidDate". The first parameter to errors.add should be the PROPERTY NAME, and not the error.

3) You likely wanted the following
errors.add( "endDate", new ActionMessage( "End date must be greater than start date." );

Otherwise, you're going to end up with a message like "Sat, June 17, 2006 00:00:00 must be greater than Sun, June 18, 2006 00:00:00", which doesn't look quite right :).

- Scott

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

Reply via email to