I used to work with VS.NET but now I need to edit some java mvc page.
It is using freemarker templates - I understood how to get data to view, but how to post data back to server?
I need controller sample with a simple textbox.
Freemarker is a general purpose templating engine, so you have to use pure HTTP form submit.
Put in your template:
<form method="post" action="/process">
<input type="text" name="myData" />
<input type="submit" />
</form>
Make sure that you have a server-side handler for http://<domain>/process
URL.
If you want to deal with forms (or whatever real-world Web page development), first you need to chose a Web Application Framework, like Stripes, Spring, etc. FreeMarker alone is just a bare-bone template engine. Forms, or any Web-related feature has to be provided by the framework, usually by framework-specific FreeMarker directives.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.