Jeff Duska wrote:

> The source code and the documenation seem to be out of sync.
> 
> The documenation suggest using the following for the Toolbox.xml file.
> 
> <tool>
>   <key>reqParser</key>
>   <class>org.apache.velocity.tools.tools.RequestParser</class>
> </tool>


Yes, the documentation is wrong. I'fix that. Thanks for the report!


> I was able to get my code to work, but I wasn't happy with one thing. I 
> have the following line of VLT in my page.
> 
> Random Number = $reqParser.getString($request,"RandomNumber")
> 
> I pass RandomNumber in URL like productpurchase?RandomNumber=12341234. I 
> surprised that when I don't pass in RandomNumber at all it causes an 
> error and the VLT code is shown. I was expecting nothing to display. Am 
> I misunderstanding how Velocity handles this?
> 
> Here is the error out of the log file
> org.apache.velocity.runtime.exception.ReferenceException: reference : 
> template = /productpurchase.vm [line 3,column 17] : 
> $reqParser.getString($request,"RandomNumber") is not a valid reference.


This problem can be avoided if you use the "Quite Reference Notation".
Search the user guide http://jakarta.apache.org/velocity/user-guide.html#References
for this term.

You would write it this way:

Random Number = $!reqParser.getString($request,"RandomNumber")


Hope this helps

Gabe


--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to