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: [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