Pedantic
Pedantic

Reputation: 1378

controller in spring for form handling

I am newbie in spring. using spring 3.0 mvc. I am creating a spring application, I have a login form,Any one please suggest what controller i should use, as when I am using SimpleFormController its saying deprecated,

Any specific controller I can use.

Upvotes: 0

Views: 199

Answers (3)

Fixus
Fixus

Reputation: 4641

First of all as everybody already told you use annotation-base controller

secondly for creating a form you can use spring form taglib

thirdly you can create method like this

public String updateHouse(House house, @RequestParam("file") MultipartFile file, Model model) {

this is from my sample application. House object is auto generated from form. In my form I have fields of my House object and it is send to the method as object. @RequestParam allows me to fetch the file witch is uploaded via form (POST), Model is my view model.

As you can see it is easy :)

Upvotes: 1

kandarp
kandarp

Reputation: 5047

You can try annotation based controller. Please refer below link:

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html

Upvotes: 1

craftsman
craftsman

Reputation: 15623

Why don't you try annotation-based controllers? They are easy and fun to use.

Upvotes: 1

Related Questions