Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Regarding @Modelattribute in spring 2.5 web MVC

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

@Controller
@RequestMapping("/Controller")
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.
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ModelAttribute is for return types to put the return into the Model. It is not for parameters.

Mark
 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic