• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic