You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Sam Huang <sa...@gmail.com> on 2005/04/22 19:36:37 UTC

Reading input via a template?

Hello,
It seems that most of the usage of Velocity is to present information, such as from an object to a web page. But what about reading information from a web page via a template file to an object? If the way to present data is like this:
web = output(object, template);
then can we read in data in the opposite direction:
object = input(web, template);
Is it possible for Velocity or other existed template engines? If it is, how to do so? Thanks!

Regards, 
Sam Hwang
 

Re: Reading input via a template?

Posted by Paul Barry <pa...@nyu.edu>.
Velocity is only handles the V in an MVC architecture.  The Controller
is still responsible for receiving input.  In the case of an web
application, the Controller receives the input from HTTP Request
Parameters, usually from an HTML Form.  Here is process:

1. User issues a GET request from web browser.
2. Controller processes GET request, loads any data needed into a context.
3. Controller determines which velocity template to use, merges data
with the template.
4. The template generates an HTML form.
5. User fills in the HTML form in their web browser and submits the
form, which issues a POST request.
6. Controller processes the data from the POST request and redirects to
the next page.

Bottom line, you cannot use a velocity template for receiving input, but
you can use it to generate an HTML form.

Sam Huang wrote:
> Hello,
> It seems that most of the usage of Velocity is to present information, 
> such as from an object to a web page. But what about reading information 
> from a web page via a template file to an object? If the way to present 
> data is like this:
> web = output(object, template);
> then can we read in data in the opposite direction:
> object = input(web, template);
> Is it possible for Velocity or other existed template engines? If it is, 
> how to do so? Thanks!
>  
> Regards,
> Sam Hwang
> <callto://samhwang> 

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