Hi once again, I have solved the first problem, so I just need info about the Ajax thing.
Greets > -----Original Message----- > From: Markus Auchmann [mailto:[EMAIL PROTECTED] > Sent: Tuesday, December 26, 2006 11:30 AM > To: 'Velocity Users List' > Subject: RE: VelocityViewServlet - tomcat - ParameterParser > > Thank you, now it is working fine! > > Unfortunately I have 2 more questions (sorry if I annoy you). > > 1.) When using the Parameter Parser I get data from a textarea field (I'm > creating a guestbook). How can I convert new lines into <br> so that it is > correctly displayed in the browser? Is there also a tool which helps me > there or is it more a java issue? > > 2.) I tried to use Velocity for my Ajax Application. Therefore I created a > .xml as template and my Ajax Application retrieves it. But, when parsing > this xml file with prototype, nothing happens. I think that I have to > modify > the header like a guy did it with the VelocityServlet > (http://appshare.de:7122/ajaxWorld/MainControl?action=matchcode): > response.setContentType("text/html"); > > ... I think this is the problem as I also generated the same xml file with > php and it works properly. So how can I modify the Content Type with > VelocityViewServlet? > > Thanks a lot, merry x-mas & a happy new year :) > Markus > > > -----Original Message----- > > From: Nathan Bubna [mailto:[EMAIL PROTECTED] > > Sent: Thursday, December 21, 2006 6:23 PM > > To: Velocity Users List > > Subject: Re: VelocityViewServlet - tomcat - ParameterParser > > > > ParameterParser uses the parameters from > > HttpServletRequest.getParameterMap(), so it doesn't distinguish > > between parameters sent via post or via get. In other words, you can > > get posted form data the same way. :) > > > > However, if this is going to become a complicated application, i'd > > recommend you use an action-based framework (like Struts, Stripes, > > Spring MVC, or others) to handle form posts in an "action" class. > > > > If it remains a pretty simple database back application, you might use > > something like Velosurf to handle updating the database. > > > > On 12/21/06, Markus Auchmann <[EMAIL PROTECTED]> wrote: > > > Thanks for the explanation it just works perfectly :) > > > > > > Another question. I want to create a guestbook with velocity and > > > viewservlet. Therefore I want to create a form which posts the data. > How > > can > > > I access the posted data? > > > > > > Thanks, > > > Markus > > > > > > > -----Ursprüngliche Nachricht----- > > > > Von: Nathan Bubna [mailto:[EMAIL PROTECTED] > > > > Gesendet: Mittwoch, 20. Dezember 2006 17:10 > > > > An: Velocity Users List > > > > Betreff: Re: VelocityViewServlet - tomcat - ParameterParser > > > > > > > > Hi Markus, > > > > > > > > You've almost got things right. The ParameterParser is used for > > > > parsing the parameters of the current ServletRequest. This means > you > > > > must have it as a request-scoped tool. When you try to put it as an > > > > application-scoped tool, then the wrong thing is sent to the init() > > > > method and the tool complains. > > > > > > > > Also, $params.getString is not the proper way to use the tool. You > > > > need to specify which request parameter you wish to get: > > > > $params.getString('foo') > > > > > > > > You can also simplify that by just doing $params.foo if you don't > > > > need to parse the parameter and just want it as a string. > > > > > > > > -nathan > > > > > > > > On 12/21/06, Markus Auchmann <[EMAIL PROTECTED]> wrote: > > > > > Hi guys, > > > > > > > > > > I downloaded the tools and tried the example provided with the > > package > > > > > (simple - servlet). It works fine. Now I want to get the parameter > > out > > > > of > > > > > the url to work with it in velocity. I think the right tool for it > > is > > > > the > > > > > ParameterParser (if not please tell me how to get the parameters > out > > of > > > > the > > > > > url). > > > > > > > > > > So I did the following: > > > > > > > > > > I added this to my toolbox.xml: > > > > > <tool> > > > > > <key>params</key> > > > > > <scope>application</scope> > > > > > > > <class>org.apache.velocity.tools.view.tools.ParameterParser</class> > > > > > </tool> > > > > > > > > > > And this to my template: > > > > > Parameter tool: $params.getString > > > > > > > > > > But when starting up tomcat I get various failures (the date tool > > for > > > > > example is working properly): > > > > > [...] > > > > > Problem loading toolbox '/WEB-INF/toolbox.xml': > > > > > java.lang.IllegalArgumentException: Was expecting interface > > > > > org.apache.velocity.tools.view.context.ViewContext or interface > > > > > javax.servlet.ServletRequest > > > > > [...] > > > > > > > > > > Do I have to download this tool to use it or should it be provided > > with > > > > the > > > > > tools-1.2 anyway? > > > > > > > > > > Thanks in advance, > > > > > markus > > > > > > > > > > > > > > > ------------------------------------------------------------------ > -- > > - > > > > > 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] > > > > > > > > > --------------------------------------------------------------------- > > > 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] > > > --------------------------------------------------------------------- > 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]
