jQuery in Action, 3rd edition
The moose likes Other Application Frameworks and the fly likes Regarding @Modelattribute in spring 2.5 web MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Regarding @Modelattribute in spring 2.5 web MVC" Watch "Regarding @Modelattribute in spring 2.5 web MVC" New topic

Regarding @Modelattribute in spring 2.5 web MVC

NareshAnkuskani Kumar
Ranch Hand

Joined: Sep 15, 2005
Posts: 76
Hi i am new to spring2.5 web mvc which uses annotations. I am making use of annotations to configure a controller and handler methods.

In springs documents i found the list of valid parameters that can be passed to the method handler, of which one is HttpServletRequest.

I had implemented the controller as below

public class Controller
@RequestMapping(method = RequestMethod.POST)
public void importData(@ModelAttribute Bean bean,HttpServletRequest request,Errors error) {

}//end of importData method
}//end of class declaration.

The above code results in the following exception
java.lang.IllegalStateException: Errors/BindingResult argument declared without preceding model attribute. Check your handler method signature!

I want to use 'request' object as part of the handler method.How i can proceed with this.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

@ModelAttribute is for return types to put the return into the Model. It is not for parameters.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link: http://aspose.com/file-tools
subject: Regarding @Modelattribute in spring 2.5 web MVC
It's not a secret anymore!