Hi Matt,

I had the same issue a few days ago, and i have chosen the 2nd way you
described:

I created a index.vm with the form and the main template. In the form I
pointed to another .vm let's call it newEntry.vm. There I used the Paramter
Parser tool to get the post data and then I called a java function to update
the database (which you have to write yourself):

newEntry.vm
--------------------------
$guestbook.newEntry($!params.getString('name'), $!params.getString('mail'),
$!params.getString('homepage'), $!params.getString('text'))

#parse("index.vm")
--------------------------

Next I just included the index.vm to once again show the user the main
template (as you can guess, it's a guestbook).

Greets,
Markus

> -----Original Message-----
> From: Matt L. [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 27, 2006 11:59 PM
> To: [email protected]
> Subject: VVS Form Submission - Best Practices
> 
> 
> I am using the VelocityViewServlet (VVS) and I would like to handle html
> form
> submission that will be writing to a database. What is the best
> practice/industry standard way of doing this?
> 
> Just off the top of my head I can think of two ways. One would be to use
> an
> entirely different servlet to handle the form submissions. It's certainly
> more appealing to have everything going through the VVS - two servlets
> seems
> pretty kludgy to me..
> 
> I could also have a destination template read the parameters and, via a
> tool, write to the database. My concern there is that the Velocity
> template
> language may not be rich enough to pull off that level of functionality. I
> also wonder about performance.
> 
> I'm sure there is something obvious that hasn't occurred to me. I looked
> in
> the documentation and searched online, but I didn't find anything to
> address
> this. Regardless, I apologize for asking such a basic question.
> 
> Thanks,
> 
> Matt
> --
> View this message in context: http://www.nabble.com/VVS-Form-Submission---
> Best-Practices-tf2888050.html#a8068626
> 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]

Reply via email to