title: How to use multiple ViewResolvers in Spring?
body: <p>I am working on a web app where I have most of my pages making use of apache tiles (2.1.2), but a few of them need to just be plain jsps.</p>
  
  <p>I am having a problem in that both an <code>InternalResourceViewResolver</code> and a <code>UrlBasedViewResolver</code> will try to resolve the view no matter what, so that no matter which ordering I use, it will either fail on the plain JSP pages, or on the tiles pages.</p>
  
  <p>Here is the config:</p>
  
  <pre><code>&lt;bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
      &lt;property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/&gt;
      &lt;property name="order" value="0"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/"/&gt;
      &lt;property name="suffix" value=".jsp"/&gt;
      &lt;property name="order" value="1"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>To make it more clear what I am trying to do, I need to be able to have view states like this:</p>
  
  <pre><code>&lt;view-state id="someState" view="/someDir/foo"&gt;&lt;!--render foo.jsp --&gt;
      &lt;transition on="foo" to="bar"/&gt;
  &lt;/view-state&gt;
  
  &lt;view-state id="someState" view="something.core"&gt;&lt;!--render tile defintion named 'something.core' --&gt;
      &lt;transition on="foo" to="bar"/&gt;
  &lt;/view-state&gt;
  </code></pre>
  
  <p>Does anyone know how to configure things so that I can get it to render tiles definitions and plain jsps?</p>