velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikko Nylén <>
Subject Problems with VelocityStruts's ErrorsTool
Date Mon, 18 Jul 2005 10:26:49 GMT

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())
    #foreach ($error in $errors.all)
#end doesn't display anything. However, if I remove the #if-line (and 
of course, the corresponding #end-line), it does display the errors as 

    <li>Username is required</li>
    <li>Password is required</li>

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));

...and when my template have this:

#foreach ($error in $errors.get("username"))

...shouldn't it display something like this?

    <li>No such user "testuser"</li>

Thanks for the reply in advance,

- Mikko Nylén

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message