You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Childers <jc...@hotels.com> on 2002/11/19 17:13:30 UTC
Selective error message display
All,
I know this question has been asked before, but I couldn't find the answer in the archive.
I would like to be able to selectively display an error, depending on what exactly it was. Here is the code from my validate method in my VacationFinderForm:
if (retCal.before(depCal))
errors.add("returningMonthError", new ActionError("finder.error.returnbeforeleave"));
And in my JSP:
<logic:present name="vacationFinderForm" property="returningMonthError">
<tr>
<td colspan="2">
<pkghtml:error property="returningMonth" />
</td>
</tr>
</logic:present>
Without the <logic:present> tags everything works fine, except the display isn't what I need it to be. I think the problem lies in the arguments being passed to the logic:present tag, but I can't figure out what they should be.
Thanks in advance,
-= James
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Selective error message display
Posted by Kris Schneider <kr...@dotech.com>.
James,
For 1.1, you might try something like:
<logic:messagesPresent property="returningMonthError">
<tr>
<td colspan="2">
<html:errors property="returningMonthError"/>
</td>
</tr>
</logic:messagesPresent>
Quoting James Childers <jc...@hotels.com>:
> All,
>
> I know this question has been asked before, but I couldn't find the answer in
> the archive.
>
> I would like to be able to selectively display an error, depending on what
> exactly it was. Here is the code from my validate method in my
> VacationFinderForm:
>
> if (retCal.before(depCal))
> errors.add("returningMonthError", new
> ActionError("finder.error.returnbeforeleave"));
>
> And in my JSP:
> <logic:present name="vacationFinderForm" property="returningMonthError">
> <tr>
> <td colspan="2">
> <pkghtml:error property="returningMonth" />
> </td>
> </tr>
> </logic:present>
>
> Without the <logic:present> tags everything works fine, except the display
> isn't what I need it to be. I think the problem lies in the arguments being
> passed to the logic:present tag, but I can't figure out what they should
> be.
>
> Thanks in advance,
>
> -= James
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Kris Schneider <ma...@dotech.com>
D.O.Tech <http://www.dotech.com/>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>