Default formView for SimpleFormController?

When you do not specify The logical view name, Spring relies on DefaultRequestToViewNameTranslator which is installed by default . So if your request is something like.

Up vote 1 down vote favorite share g+ share fb share tw.

Firstly I would like to say that I am quite new to Spring (in particular the MVC framework), and just trying to understand how everything works so please go easy on me. I'm playing around with a dummy application that I've created, and I've created a simple login form that users can access via the /login. Html bean.

The bean definition is as follows: (the Login class is a simple object containing a username and password field with appropriate getters and setters). The LoginController class does virtually nothing for now: public class LoginController extends SimpleFormController { @Override protected ModelAndView onSubmit(Object command, BindException errors) throws Exception { return new ModelAndView(new RedirectView(getSuccessView())); } } Now I have one view resolver in my bean definition file, which goes as follows: To support my Login form I have a login. Jsp file in my jsp directory.

My question is as follows: why does accessing /login. Html redirect me to login. Jsp?

I have not specified a formView property for my form, so how does the view resolver know to redirect me to login. Jsp? Thanks in advance for any help!

Joseph. Spring-mvc link|improve this question asked Jul 20 '10 at 4:33Joseph Paterson22517 78% accept rate.

– janogonzalez Jul 20 '10 at 4:53 Good question... – Joseph Paterson Jul 20 '10 at 6:47.

When you do not specify The logical view name, Spring relies on DefaultRequestToViewNameTranslator, which is installed by default. So if your request is something like http://127.0.0.1:8080/app/. Html Have you seen?

So if your request is http://127.0.0.1:8080/app/login. Html The logical name extracted by ViewNameTranslator is login which is supplied To viewResolver and Translated To /jsp/login. Jsp Nothing else.

Makes perfect sense - thanks! – Joseph Paterson Jul 20 '10 at 6:47.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions