Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

[spring] can XmlViewResolver resolve to a jsp?

 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The examples for XmlViewResolver and XmlFileViewResolver that I saw, resolves into rss, xls, and pdf only. Can the view from these resolvers be jsps?
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
XmlViewResolver can use for JSPs. Actually, XmlViewResolver just for specifying resource location in XML file.

But I don't know what XmlFileViewResolver is.
 
Jesus Angeles
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kengkaj Sathianpantarit wrote:XmlViewResolver can use for JSPs. Actually, XmlViewResolver just for specifying resource location in XML file.

But I don't know what XmlFileViewResolver is.



Nevermind about XmlFileViewResolver. It could be a mistype in the book that I am reading.

Can you show me how the declaration is done, mapping to a jsp, using XmlViewResolver?
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. The following configuration uses XmlViewResolver to redirect to a controller which will dispatch to a JSP.

views.xml
<bean id="newPersonSuccess"
class="org.springframework.web.servlet.view.RedirectView">
<property name="contextRelative" value="true" />
<property name="url" value="/personSuccess" />
</bean>



<bean name="/personSuccess"
class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />



I copy from Expert Spring MVC and Web Flow book.
 
Jesus Angeles
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like we will redirect to another controller, which will later result into a jsp.

But that involves calling 2 controllers.

At the point views.xml is consulted, the Model is already available. I just need to resolve to a jsp, just like the InternalResourceViewResolver. This solution will again go to another controller.

(Much like struts, I want the flexibility to have the View name not necessarily the same as the jsp prefix.)

Any idea how to do it?
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know, but using controller give you advantage to abstract real path of JSPs, you can specify prefix and suffix.
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic