Manish wrote:
change
#if ($errors.exists())
to
#if ($errors.exist())
HTH,
- Manish
----- Original Message -----
From: "Mikko Nylén" <[EMAIL PROTECTED]>
To: <[email protected]>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Thanks for the reply. Removing that extra "s" from "exists" did solve
the first problem. I was so used to use "exists" instead of "exist", so
it seems that my brains simply ignored the missing "s" found from APIs.
I agree, I need an optician...
- Mikko Nylén
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]