title: Why does my JSF + Spring web application output JSF source code instead of interpreted HTML page?
body: <p>I'm new to both JSF and Spring Framework and I'm trying to figure out how to make them work together.
  My current problem is that application outputs my JSF files without interpreting them. 
  Here are some snippets of my code which I believe might be relevant:</p>
  
  <p><strong>dispatcher-servlet.xml</strong></p>
  
  <pre><code>&lt;bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&gt;
      &lt;property name="mappings"&gt;
          &lt;props&gt;
              &lt;prop key="login.htm"&gt;loginController&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver"
        p:prefix="/WEB-INF/pages/"
        p:suffix=".xhtml" /&gt;
  
  &lt;bean name="loginController" class="controller.LoginController" /&gt;
  </code></pre>
  
  <p><strong>loginController</strong></p>
  
  <pre><code>public class LoginController extends MultiActionController {
   public ModelAndView login(HttpServletRequest request,
     HttpServletResponse response) throws Exception {
      System.out.println("LOGIN");
      return new ModelAndView("login");
  }
  </code></pre>
  
  <p><strong>WEB-INF/pages/login.xhtml</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"&gt;
  &lt;h:head&gt;
      &lt;title&gt;#{message.log}&lt;/title&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h:form&gt;
          &lt;h:outputLabel value="#{message.username}" for="userName"&gt;
              &lt;h:inputText id="userName" value="#{User.name}" /&gt;
          &lt;/h:outputLabel&gt;            
          &lt;h:commandButton value="#{message.loggin}" action="#{User.login}" /&gt;
      &lt;/h:form&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any ideas where the problem might be? Does this code make any sense at all? I'm well aware of fact, that probably completely sucks and I'll be glad to here WHY it sucks and how to make it better. Thanks :)</p>
  
  <p>EDIT: I'm adding piece of code which seems to be the root of the problem and which I (of course) didn't include in the original question:</p>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>The url-pattern of Faces Servlet had to be changed to *.xhtml in order to work properly.</p>