Hi. If I'm using JSP and Servlets with Spring, why I have to use a view resolver such :
And if I want to use JSP&Servlets, which resolver I have to use (or when to use it) : org.springframework.web.servlet.view.ResourceBundleViewResolver or org.springframework.web.servlet.view.InternalResourceViewResolver Thanks.
ViewResolvers exist to allow Controllers (you are using Spring Controllers aren't you ?) to specify views by logical names rather than physical url's directly. This makes it much easier to refactoryour UI code or to change the type of view you want to render, say from JSP to PDF. If you make a change, you won't have change the Controller, just the mapping.
InternalResourceViewResolver is a subclass of UrlBasedViewResolver that supports JSP's. UrlBasedViewResolver can map view names to views without having to supply an explicit mapping. You can just use naming conventions to do the mapping. ResourceBundleViewResolver is very convenient if internationalization is needed or may ever be needed. The Java ResourceBundle class javadoc has more info regarding internationalization naming conventions. Spring's ResourceBundleViewResolver provides support for those file naming conventions.
The Spring javadocs and reference documentation are really very good andprovide much more detail about this and other issues than I can. You should try reading them.
kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Well, I'm using JSP&Servlets (not Spring MVC or any other framework), How can I use Spring controllers ? Even if I'm using regular JSP and Servlets, I have to use Spring controllers ? [ January 20, 2006: Message edited by: John Todd ]
John, if you're not using Spring Controllers then you don't need to use a Spring ViewResolver either. What makes you think you need one? Are you getting some kind of an exception implying something along those lines?
Please correct me if I'm wrong : Spring controllers are part of Spring MVC framework and we use it only when we use Spring MVC framework. Not with JSF, Struts, Tapestry or even regular JSP and Servlets .... Well, please be patient, I'm new with Spring.