• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why we need a resolver ?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ken Krebs
Ranch Hand
Posts: 451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(you are using Spring Controllers aren't you ?)

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 ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic