velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malcolm Edgar" <malcolm.ed...@gmail.com>
Subject Re: VelocityViewServlet and HTML form
Date Tue, 07 Aug 2007 11:03:15 GMT
Hi Patrick,

If you are doing a lot of form work, you may find the Click Framework
useful. Its a web framework which uses Velocity for rendering, and has
extensive form support.

regards Malcolm Edgar
http://click.sourceforge.net

On 8/7/07, Claude Brisson <claude@renegat.net> wrote:
> Le mardi 07 août 2007 à 09:56 +0200, Patrick Olivier a écrit :
> > Hi,
> >
> > I'm trying to modify the simple example provided with velocity tools 1.3 (
> > simple.war ). What i want to do is to add an html form in the index.vm template
> > :
> >
> > ...
> > <form method="post" action="index.vm">
> > <input type="text" name="message" value="$!toytool.message">
> > <input type="submit" value="Send">
> > </form>
> > ...
> >
> > When pressing down the 'Send' button, i'm expecting an access to the setter of
> > message in ToyTool ( the getter works well ), but nothing happens !
> > What's wrong in the code above ?
> > do i forget something ( or misunderstand something ? )
>
> Wrong expectation... Velocity doesn't know what a form is. The form is
> submitted on the client side, Velocity is on the server side.
>
> When you press the 'Send' button, the server will receive a request on
> index.vm with the 'message' HTTP query attribute set to your value. At
> this point, you can use the ParameterParser tool to grab the value :
>
> #if($param.message) #set($toytool.message = $param.message) #end
>
>
>   Claude
>
> > Thx for your help.
> > -Patrick
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> > For additional commands, e-mail: user-help@velocity.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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


Mime
View raw message