Results 1 to 3 of 3

Thread: Flexibility of ViewResolver

  1. #1
    Join Date
    Sep 2004
    Location
    San Francisco Bay Area
    Posts
    1

    Default Flexibility of ViewResolver

    Folks,

    Wanted to start a dialog in hopes of clearing up some confusion about ViewResolvers.

    I have checked the docs on this ... and a question still remains. If one did not want to base the View on a file extension ... how could I create a flexible resolver that would take a JSP name or servlet name .. and always forward it properly??? As it is now, I have a viewResolver prepending path and appending extension for JSP's ... I would like to keep this. I realize that I need to specify a different view to handle a request ... but not sure how to set this within a servlet (without writing my own drawn out implementation of 1 of the interfaces)

    I thought I could use setView inside of my controller class .. but I learned quickly .. not.

    The only example I have been able to find tests the file extension and then requires that a seperate properties file exists to do the mapping. Is there a more elegant way to do this? I like this technology ... but the lack of docs/books kinda sucks. Anyways ...

    Any feedback, ideas or mindless gibberish is welcome.

    Thanks,
    ~daleF

  2. #2

    Default

    I'm not really sure what you are asking here.. the question:

    If one did not want to base the View on a file extension ... how could I create a flexible resolver that would take a JSP name or servlet name .. and always forward it properly?
    Is a bit vague for me to understand your circumstance. Could you post something specific? I am using (and happy with) ViewResolver. However, I also have other types of files that are served and I return the view for those (specifically an InternalResourceView to return a zip file for example) directly from the controller. What file are you trying to reference that you can't with ViewResolver or by setting the view directly in your controller, or using one of the other resolvers in a chain?

  3. #3
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    There are all different kinds of view resolvers that should suit your needs, at least, they did in my projects.

    The XmlViewResolver takes an application context in which you define beans, representing you views, the ResourceBundleViewResolver does the same, but then with properties files (you can also have per-language properties file).

    Like Steven said, could you be a bit more specific?

Similar Threads

  1. Weird ViewResolver Chaining Issue
    By allanyao in forum Web
    Replies: 6
    Last Post: Nov 10th, 2010, 07:35 AM
  2. Use viewresolver for fronting jsp's?
    By ryan.tyer in forum Web
    Replies: 3
    Last Post: Oct 31st, 2008, 07:11 AM
  3. Time To Send ViewResolver Expert
    By cybersurvivor in forum Web
    Replies: 4
    Last Post: Jan 24th, 2008, 11:15 AM
  4. Replies: 3
    Last Post: Feb 17th, 2005, 12:54 PM
  5. Theme based ViewResolver?
    By jfmenard in forum Web
    Replies: 1
    Last Post: Nov 16th, 2004, 01:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •