velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manish" <prol...@gmx.net>
Subject Re: Problems with VelocityStruts's ErrorsTool
Date Mon, 18 Jul 2005 10:50:44 GMT
change
#if ($errors.exists())
to
#if ($errors.exist())

HTH,
- Manish


----- Original Message -----
From: "Mikko Nylén" <mikko.nylen@gmail.com>
To: <velocity-user@jakarta.apache.org>
Sent: Monday, July 18, 2005 3:56 PM
Subject: Problems with VelocityStruts's ErrorsTool


> Hi!,
>
> I have a little problem with VelocityStruts's ErrorsTool's exists()
> method. It seems that it isn't working properly, as if I do write
> something like this in my template:
>
> #if ($errors.exists())
>     <ul>
>     #foreach ($error in $errors.all)
>        <li>$error</li>
>     #end
>     </ul>
> #end
>
> ...it doesn't display anything. However, if I remove the #if-line (and
> of course, the corresponding #end-line), it does display the errors as
> expected:
>
> <ul>
>     <li>Username is required</li>
>     <li>Password is required</li>
> </ul>
>
> What could be wrong?
>
> Another issue I have met is with the ErrorsTool's get(String property)
> method. If I do something like this in my action class's execute():
>
> ActionMessages errors = new ActionMessages();
> errors.add("username", new ActionMessage("error.noSuchUser", username));
> saveErrors(errors);
>
> ...and when my template have this:
>
> <ul>
> #foreach ($error in $errors.get("username"))
>     <li>$error</li>
> #end
> </ul>
>
> ...shouldn't it display something like this?
>
> <ul>
>     <li>No such user "testuser"</li>
> </ul>
>
>
> Thanks for the reply in advance,
>
> - Mikko Nylén
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message