• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why we need a resolver ?

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic