1

It might sound like a weird question. Here is my situation: I'm writing a web application using Spring MVC 3.x I'm using UrlBasedViewResolver and Tiles combo to resolve the view.

My webContext.xml

    <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
</bean>

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/tiles.xml</value>
        </list>
    </property>
</bean>

My tiles.xml

    <definition name="main" template="/WEB-INF/views/tiles/template.jsp">
    <put-attribute name="resources" value="/WEB-INF/views/tiles/resources.jsp" />
    <put-attribute name="header" value="/WEB-INF/views/tiles/header.jsp"/>
    <put-attribute name="title" value="" />
    <put-attribute name="content" value="" />
</definition> 

<definition name="index" extends="main">
    <put-attribute name="windowTitle" value="Some Name"/>       
    <put-attribute name="content" value="/WEB-INF/views/index.jsp"/>        
</definition>

<definition name="dartWorkQueue" extends="main">
    <put-attribute name="windowTitle" value="Some Name"/>       
    <put-attribute name="content" value="/WEB-INF/views/XXXWorkQueue.jsp"/>     
</definition>
<definition>
     ......     
</definition>

  <definition>      
     ......
</definition>

Now, what I want is for one of the scenario when the controller is called based on the URL from the JSP, the handler method should direct to some java bean that will render the output instead of a JSP.

So basically, my question is, is it possible to ask the UrlBasedViewResolver to look into two different xmls for view resolution.

For example: If the handler returns a view-name, it should first look into tiles.xml and if it doesn't find any mapping there, then it should look in some XXX.xml

Or should I take a different approach altogether.

tarares
  • 392
  • 4
  • 10
  • 27

0 Answers0