• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Neither BindingResult nor plain target object for bean name 'cmd' available as request attribute

 
Parth Patel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Spring and I am not able to solve this issue. I read almost all the post regarding this issue but I am not able to figure out the problem in my code.

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'cmd' available as request attribute

I am getting this error only at the loading of the page for the first time. In edit mode it works perfectly fine.

Controller Class Object

JSP

Bean

Object


Any help will be appreciated.

Thanks,
Parth
 
Tommy Delson
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




In summary, you need to define the commandClass CmdMasterModule and bind it with command name "cmd". Your bean configuration is not correct so, it won't work. Reconfigure and see if that help...
 
Parth Patel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tommy Delson,

The command class is already defined. I didn't understood what exactly you mean to say. The same structure is applied everywhere in the project and everything else runs perfect. I am not able to understand why only this module fails to load for the first time.

Did you mean to say that I need to set the command class and command name in the constructor of the controller ?

for e.g :


I tried it with the above code too but it didn't help.


Please can you give me an example related to my code or explain a little more detail about the code ?

Thanks,
Parth
 
Prasad Krishnegowda
Ranch Hand
Posts: 670
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can once try with form binding?
Can you show us your complete code, because i can't see id used in controller, declared anywhere and also JSP, so that we can see the taglib used for <spring:bind>.

P:S: Still having controllers extend the spring classes, its been deprecated from spring 3.0 and will be removed in the future, I would recommend to use annotations instead of SimpleFormControllers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic