You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by James Roycroft <ja...@telus.net> on 2003/10/26 18:11:03 UTC

Anomaly with errorMarkup macro in velstruts example 3 (Related to bug 24133)

This is related to Bug #24133 and concerns the macro in index.vm of the
logon example (number 3) in the velstruts example war file from Velocity
Tools version 1.0

When I rename the global macro library (VM_global_library.vm) or by some
means prevent it from loading, and then run through the example, the
username/password error that normally appears when you do not enter anything
and simply click 'submit' does not show up. The macro that does this is
available in two places, the global library, and index.vm. The only
difference between them is the change I made below:

By changing the macro in index.vm to use '#if ($errors.exist() )' as opposed
to the current '#if ($errors.exist )', the example works. I am not an
experienced Velocity user so I may be missing something obvious here, but
isn't that strange? I cannot reproduce the error using a more simple test
case.

Suggestions/Ideas, or is more info needed?


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


RESOLVED - Re: Anomaly with errorMarkup macro in velstruts example 3 (Related to bug 24133)

Posted by James Roycroft <ja...@telus.net>.
You are quite right. It does not display anything when I change it to
'$errors.exist', and I must have missed the ReferenceException warning in
the log file the first time around, but I see it now. Thanks for your help.

----- Original Message ----- 
From: "Nathan Bubna" <na...@esha.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Sunday, October 26, 2003 11:21 PM
Subject: Re: Anomaly with errorMarkup macro in velstruts example 3 (Related
to bug 24133)


> James Roycroft said:
> > I do not understand why it breaks. When I try this out with a much
simpler
> > test case, using '$errors.exist', it works fine. Why would it break in
the
> > example app?
>
> i highly doubt that it does.  have you tried reversing your test macro so
that
> you are testing if errors *do* exist instead of testing if they *don't*?
>
> Velocity's shorthand notation for methods (where you can leave off the
> parentheses) only works for bean-style methods (i.e. methods prefixed by
> "get", "set", or "is") or else values returned by a get(String) method.
>
> in other words, #if( !$errors.exist ) foo #end  will always display ' foo
'
> because there is no isExist(), or getExist() method in the ErrorsTool.
you
> must do $errors.exist().
>
> Nathan Bubna
> nathan@esha.com
>
>
> ---------------------------------------------------------------------
> 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


Re: Anomaly with errorMarkup macro in velstruts example 3 (Related to bug 24133)

Posted by Nathan Bubna <na...@esha.com>.
James Roycroft said:
> I do not understand why it breaks. When I try this out with a much simpler
> test case, using '$errors.exist', it works fine. Why would it break in the
> example app?

i highly doubt that it does.  have you tried reversing your test macro so that
you are testing if errors *do* exist instead of testing if they *don't*?

Velocity's shorthand notation for methods (where you can leave off the
parentheses) only works for bean-style methods (i.e. methods prefixed by
"get", "set", or "is") or else values returned by a get(String) method.

in other words, #if( !$errors.exist ) foo #end  will always display ' foo '
because there is no isExist(), or getExist() method in the ErrorsTool.  you
must do $errors.exist().

Nathan Bubna
nathan@esha.com


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


Re: Anomaly with errorMarkup macro in velstruts example 3 (Related to bug 24133)

Posted by James Roycroft <ja...@telus.net>.
I do not understand why it breaks. When I try this out with a much simpler
test case, using '$errors.exist', it works fine. Why would it break in the
example app?

My test case - errorstest.vm:

Before errors.exist <br><br>

#macro (showErrors)
 This is inside a macro
 #if (!$errors.exist)
  <p>errors do not exist</p>
 #end
#end
#showErrors()

<br><br> After errors.exist


----- Original Message ----- 
From: "Nathan Bubna" <na...@esha.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Sunday, October 26, 2003 5:25 PM
Subject: Re: Anomaly with errorMarkup macro in velstruts example 3 (Related
to bug 24133)


> James Roycroft said:
> > This is related to Bug #24133 and concerns the macro in index.vm of the
> > logon example (number 3) in the velstruts example war file from Velocity
> > Tools version 1.0
> >
> > When I rename the global macro library (VM_global_library.vm) or by some
> > means prevent it from loading, and then run through the example, the
> > username/password error that normally appears when you do not enter
anything
> > and simply click 'submit' does not show up. The macro that does this is
> > available in two places, the global library, and index.vm. The only
> > difference between them is the change I made below:
> >
> > By changing the macro in index.vm to use '#if ($errors.exist() )' as
opposed
> > to the current '#if ($errors.exist )', the example works. I am not an
> > experienced Velocity user so I may be missing something obvious here,
but
> > isn't that strange? I cannot reproduce the error using a more simple
test
> > case.
> >
> > Suggestions/Ideas, or is more info needed?
>
> no more info is needed, that is definitely a typo bug.  thanks for
spotting
> it.  i've fixed it now in the cvs head.  sorry for any confusion.
>
> Nathan Bubna
> nathan@esha.com
>
>
> ---------------------------------------------------------------------
> 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


Re: Anomaly with errorMarkup macro in velstruts example 3 (Related to bug 24133)

Posted by Nathan Bubna <na...@esha.com>.
James Roycroft said:
> This is related to Bug #24133 and concerns the macro in index.vm of the
> logon example (number 3) in the velstruts example war file from Velocity
> Tools version 1.0
>
> When I rename the global macro library (VM_global_library.vm) or by some
> means prevent it from loading, and then run through the example, the
> username/password error that normally appears when you do not enter anything
> and simply click 'submit' does not show up. The macro that does this is
> available in two places, the global library, and index.vm. The only
> difference between them is the change I made below:
>
> By changing the macro in index.vm to use '#if ($errors.exist() )' as opposed
> to the current '#if ($errors.exist )', the example works. I am not an
> experienced Velocity user so I may be missing something obvious here, but
> isn't that strange? I cannot reproduce the error using a more simple test
> case.
>
> Suggestions/Ideas, or is more info needed?

no more info is needed, that is definitely a typo bug.  thanks for spotting
it.  i've fixed it now in the cvs head.  sorry for any confusion.

Nathan Bubna
nathan@esha.com


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