velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikko Nylén <mikko.ny...@gmail.com>
Subject Problems with VelocityStruts's ErrorsTool
Date Mon, 18 Jul 2005 10:26:49 GMT
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


Mime
View raw message