Announcement Announcement Module
Collapse
No announcement yet.
Flexibility of ViewResolver Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment


    • #3
      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?

      Comment

      Working...
      X