I've been racking my brains trying to find a way to solve the double quotes problem in 1.4 and finally gave in and moved up to 1.5 believing that it is now all fixed..... However, the following gives me a parser error at the use of the "".
#set ($Anchor="<a href='javascript:void(0)' onclick='OpenAttachmentsWindow(""$AppPath/file/database?datasrc=$DataSou rce&view=document&key=$Key&${UniqueNumber}${velocityCount}.${FileExt}"") '>") What am I doing wrong? Thans, Steve -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] .org] On Behalf Of janbrito Sent: 21 February 2007 18:52 To: user@velocity.apache.org Subject: Re: [ANNOUNCE] Velocity-Struts Thanks for your help Nathan. My application is running ok now. I forgot to mention that I was also using Spring framework so what I did was update all the libraries I was using (Spring 2.0.2 and Velocity 1.5) and now the application works fine. Thanks for your time Nathan. Nathan Bubna wrote: > > Are you still using Velocity 1.4? I'm pretty sure that it's not > possible to get that same error with Velocity 1.5-beta2. Also, can > you send the log output? And have you tried running the > velocity-struts example app? > > On 2/21/07, janbrito <[EMAIL PROTECTED]> wrote: >> >> Hi Nathan, >> >> Thanks for your comments. I made the changes but I'm still getting the >> same >> error when $msg.label.portal.welcome gets executed. It's like for some >> reason Velocity can't see the Struts ApplicationResource file and can't >> find >> the message. >> >> Any body see what's missing here? >> >> Thanks >> >> >> Nathan Bubna wrote: >> > >> > On 2/20/07, janbrito <[EMAIL PROTECTED]> wrote: >> >> >> >> Hi, I'm trying to get Velocity working on a struts application. This >> is >> >> what >> >> I've dono so far: >> > >> > Have you looked at the "struts" example application that comes with >> > VelocityTools? That might help you find problems in your setup. >> > >> >> 1) Added to the project the velocity libraries (velocity-1.4.jar, >> >> velocity-dep-1.4.jar and velocity-tools-1.3.jar) >> > >> > I strongly recommend upgrading to velocity-dep-1.5-beta2. It is quite >> > stable and contains numerous bug fixes and improvements. Velocity >> > 1.5 final should be released in just a week or so, and there have been >> > few changes since 1.5-beta2. >> > >> >> 2) Added this to my web.xml file: >> >> >> >> <servlet> >> >> <servlet-name>velocity</servlet-name> >> >> <servlet-class> >> >> org.apache.velocity.tools.view.servlet.VelocityViewServlet >> >> </servlet-class> >> >> <init-param> >> >> <param-name>org.apache.velocity.toolbox</param-name> >> >> <param-value>/WEB-INF/toolbox.xml</param-value> >> >> </init-param> >> >> </servlet> >> >> >> >> <servlet-mapping> >> >> <servlet-name>velocity</servlet-name> >> >> <url-pattern>*.vm</url-pattern> >> >> </servlet-mapping> >> > >> > looks good >> > >> >> 3) Created the toolbox.xml file in WEB-INF dir with this content: >> >> >> >> <?xml version="1.0"?> >> >> <toolbox> >> >> <tool> >> >> <key>link</key> >> >> <scope>request</scope> >> >> <class> >> >> org.apache.velocity.tools.struts.StrutsLinkTool >> >> </class> >> >> </tool> >> >> <tool> >> >> <key>msg</key> >> >> <scope>request</scope> >> >> <class> >> >> org.apache.velocity.tools.struts.MessageTool >> >> </class> >> >> </tool> >> >> <tool> >> >> <key>errors</key> >> >> <scope>request</scope> >> >> <class> >> >> org.apache.velocity.tools.struts.ErrorsTool >> >> </class> >> >> </tool> >> >> <tool> >> >> <key>form</key> >> >> <scope>request</scope> >> >> <class> >> >> org.apache.velocity.tools.struts.FormTool >> >> </class> >> >> </tool> >> >> <tool> >> >> <key>tiles</key> >> >> <scope>request</scope> >> >> <class> >> >> org.apache.velocity.tools.struts.TilesTool >> >> </class> >> >> </tool> >> >> <tool> >> >> <key>validator</key> >> >> <scope>request</scope> >> >> <class> >> >> org.apache.velocity.tools.struts.ValidatorTool >> >> </class> >> >> </tool> >> >> </toolbox> >> > >> > looks good. >> > >> >> 4) Created an example index.vm file with only this code: >> >> >> >> <html> >> >> <head> >> >> <title>$msg.get("label.portal.welcome")</title> >> >> </head> >> >> <body bgcolor="white"> >> >> >> >> </body> >> >> </html> >> > >> > looks fine, but you can simplify it a bit by changing >> > >> > $msg.get("label.portal.welcome") -> $msg.label.portal.welcome >> > >> >> label.portal.welcome is defined on my ApplicationResource.properties >> >> struts >> >> file. >> >> >> >> When I access the index file I get the following error: >> >> >> >> VelocityViewServlet : Error processing a template for path >> >> '/jsp/index.vm' >> >> >> >> java.lang.NullPointerException >> >> at >> >> org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:319) >> >> at >> > >> > i don't remember the exact trigger for this, but this is a bug which >> > has been fixed in Velocity 1.5-beta2. >> > >> > <snip/> >> >> >> >> So I pretty sure I've missed a step or two when setting Velocity up :) >> > >> > i'm not sure. do you have logging setup? >> > >> >> Also, I would like to know how do I replace velocity tags with >> database >> >> values I retrieve on my action classes. >> > >> > in your action, put those database values into the HttpServletRequest >> > attributes: >> > >> > request.setAttribute("myDBValue", myDBValue); >> > >> > then, in your template, just do: >> > >> > $myDBValue >> > >> > >> >> Thanks >> >> -- >> >> View this message in context: >> >> http://www.nabble.com/Velocity-Struts-tf3263441.html#a9071152 >> >> Sent from the Velocity - User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> 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] >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Velocity-Struts-tf3263441.html#a9080785 >> Sent from the Velocity - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> 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] > > > -- View this message in context: http://www.nabble.com/Velocity-Struts-tf3263441.html#a9086786 Sent from the Velocity - User mailing list archive at Nabble.com. --------------------------------------------------------------------- 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]