*
The moose likes Other Application Frameworks and the fly likes [spring]  can XmlViewResolver resolve to a jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "[spring]  can XmlViewResolver resolve to a jsp?" Watch "[spring]  can XmlViewResolver resolve to a jsp?" New topic
Author

[spring] can XmlViewResolver resolve to a jsp?

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
The examples for XmlViewResolver and XmlFileViewResolver that I saw, resolves into rss, xls, and pdf only. Can the view from these resolvers be jsps?
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
XmlViewResolver can use for JSPs. Actually, XmlViewResolver just for specifying resource location in XML file.

But I don't know what XmlFileViewResolver is.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
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

Joined: Jul 05, 2005
Posts: 1936
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

Joined: Feb 26, 2005
Posts: 2049
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

Joined: Jul 05, 2005
Posts: 1936
I don't know, but using controller give you advantage to abstract real path of JSPs, you can specify prefix and suffix.
 
 
subject: [spring] can XmlViewResolver resolve to a jsp?
 
Similar Threads
Private methods
Can the color for the disabled item be changed
WA #1.....word association
URGENT - NEED HELP - Block Code
error in Marcus Green 2.