I have runnung example with @ModelAttribute in method param as follows
I have just created one more class LoginFormDto as same like LoginForm (you can say duplicate class) and add 2 more method in same controller
When I hit url for dologin1.htm (GET) i am getting following error
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'loginForm' available as request attribute
Everything work fine for url dologin.htm
I am not getting what exactly i am missing?
Can anyone please point me...
Joined: Dec 28, 2010
Now I got it why it was not working.
Following is my understanding about the above example.
I did not specified name for ModelAttribute ie(something like @ModelAttribute("loginForm")) . So the container assume name as a Class Name ( first character small)
@ModelAttribute LoginForm => @ModelAttribute("loginForm")
In my second example i used @ModelAttribute LoginFormDto so the container by default looking for
attribute "loginFormDto" not for "loginForm"
If I give explicitly attribute name with ModelAttribute it works without any issue.