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 Re: Problems with VelocityStruts's ErrorsTool
Date Mon, 18 Jul 2005 11:09:40 GMT
Manish wrote:

>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
>
>
>  
>
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: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message