title: JSF xhtml page not found
body: <p>I've been trying to follow various articles on setting up my first JSF application and can't get my first xhtml page to be found.  I keep getting the error "This application has no explicit mapping for /error, so you are seeing this as a fallback" in the browser.</p>
  
  <p>In the browser, I type <a href="http://localhost:8080/modelSimulation.xhtml" rel="nofollow noreferrer">http://localhost:8080/modelSimulation.xhtml</a> to get this error, and in the console, I see:
  ... :GET "/modelSimulation.xhtml", parameters={} 
  ... :No mapping for GET /modelSimulation.xhtml</p>
  
  <p>My spring boot application has added the various things required to setup JSF with spring boot, but clearly I'm missing something to be able to view my modelSimulation.xhtml page.  What am I missing? Thanks!</p>
  
  <p>I also tried <a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a> but get corresponding no mapping error too.</p>
  
  <hr>
  
  <p><strong>src/main/webapp/WEB-INF/modelSimulation.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://xmlns.jcp.org/jsf/html"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"&gt;
  &lt;ui:composition template="layout.xhtml"&gt;
      &lt;ui:define name="content"&gt;
          &lt;h:form id="mainForm"&gt;
              &lt;p:panel header="Details"&gt;
                  &lt;h:panelGrid columns="1"&gt;
                      &lt;p:outputLabel for="symbol" value="Symbol: " /&gt;
                      &lt;p:inputText id="symbol" value="#{tradingModelSimulationController.symbol}" /&gt;
                      &lt;p:outputLabel for="ranking" value="ranking: " /&gt;
                      &lt;p:inputNumber id="ranking" value="#{tradingModelSimulationController.ranking}" /&gt;
                      &lt;h:commandButton value="apply" action="#{tradingModelSimulationController.apply}" /&gt;
                  &lt;/h:panelGrid&gt;
              &lt;/p:panel&gt;
          &lt;/h:form&gt;
      &lt;/ui:define&gt;
  &lt;/ui:composition&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>src/main/webapp/WEB-INF/web.xml:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="3.1"&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;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <hr>
  
  <p>I added the 2 required beans to the <strong>SpringBootApplication class</strong>:</p>
  
  <pre><code>@Bean
  public ServletRegistrationBean servletRegistrationBean() {
      FacesServlet servlet = new FacesServlet();
      return new ServletRegistrationBean(servlet, "*.jsf");
  }
  @Bean
  public FilterRegistrationBean rewriteFilter() {
      FilterRegistrationBean rwFilter = new FilterRegistrationBean(new RewriteFilter());
      rwFilter.setDispatcherTypes(EnumSet.of(DispatcherType.FORWARD, DispatcherType.REQUEST,
              DispatcherType.ASYNC, DispatcherType.ERROR));
      rwFilter.addUrlPatterns("/*");
      return rwFilter;
  }
  </code></pre>
  
  <hr>
  
  <p>Here's the backing bean  <strong>(I don't understand the @Join...)</strong></p>
  
  <pre><code>@Scope(value = "session")
  @Component(value = "tradingModelSimulationController")
  @ELBeanName(value = "tradingModelSimulationController")
  @Join(path = "/modelSimulation", to = "/modelSimulation.jsf")
  public class TradingModelSimulationController {
  
      ModelSimulation modelSimulation = new ModelSimulation();
  
      String symbol;
      int ranking;
  
      public void apply() {
  
          System.out.println("Applied: " + modelSimulation.toString());
  
          RequestContext.getCurrentInstance()
              .execute("handleMsg('applied!');");
      }
  
      public ModelSimulation getModelSimulation() {
          return modelSimulation;
      }
  
      public String getSymbol() {
          return symbol;
      }
  
      public void setSymbol(String symbol) {
          this.symbol = symbol;
      }
  
      public int getRanking() {
          return ranking;
      }
  
      public void setRanking(int ranking) {
          this.ranking = ranking;
      }
  }
  </code></pre>