title: JSF code displayed on browser
body: <p>I am learning JSF and got help from <a href="http://exadel.com/web/portal/jsftutorial-kickstart" rel="nofollow noreferrer">Exadel.com</a>. I followed the steps described there.</p>
  
  <p>The web.xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      id="WebApp_ID" version="2.5"&gt;
      &lt;display-name&gt;FBApp&lt;/display-name&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
          &lt;param-value&gt;server&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.CONFIG_FILES&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/faces-config.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
      &lt;/listener&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;/faces/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>faces-config.xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;faces-config xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
      version="1.2"&gt;
  
      &lt;navigation-rule&gt;
          &lt;from-view-id&gt;/pages/inputname.jsf&lt;/from-view-id&gt;
          &lt;navigation-case&gt;
              &lt;from-outcome&gt;greeting&lt;/from-outcome&gt;
              &lt;to-view-id&gt;/pages/greeting.jsf&lt;/to-view-id&gt;
          &lt;/navigation-case&gt;
      &lt;/navigation-rule&gt;
      &lt;managed-bean&gt;
          &lt;managed-bean-name&gt;personBean&lt;/managed-bean-name&gt;
          &lt;managed-bean-class&gt;com.fbapp.bean.PersonBean&lt;/managed-bean-class&gt;
          &lt;managed-bean-scope&gt;request&lt;/managed-bean-scope&gt;
      &lt;/managed-bean&gt;
  
  &lt;/faces-config&gt;
  </code></pre>
  
  <p>index.jsp:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8"
      pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;index&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;jsp:forward page="faces/pages/inputname.jsf" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>inputname.jsp:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %&gt;
  &lt;html&gt;
   &lt;head&gt;
    &lt;title&gt;enter your name page&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
     &lt;f:view&gt;
       &lt;h1&gt;
        &lt;h:outputText value="JSF KickStart"/&gt;
       &lt;/h1&gt;
       &lt;h:form id="helloForm"&gt;
        &lt;h:outputText value="Tell us your name"/&gt;
        &lt;h:inputText value="#{personBean.personName}" /&gt;
        &lt;h:commandButton action="greeting" value="Say Hello" /&gt;
       &lt;/h:form&gt;
     &lt;/f:view&gt;
   &lt;/body&gt;
  &lt;/html&gt;  
  </code></pre>
  
  <p>Now the difference present is:</p>
  
  <ul>
  <li>In index.jsp I used <code>&lt;jsp:forward page="faces/pages/inputname.jsf" /&gt;</code> and Exadel used <code>&lt;jsp:forward page="/pages/inputname.jsf" /&gt;</code></li>
  <li>I have used <code>&lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;</code> and they used : <code>
  &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;</code></li>
  </ul>
  
  <p>The jar libraries are:</p>
  
  <ul>
  <li>commons-beanutils-1.7.0.jar</li>
  <li>commons-codec-1.3.jar</li>
  <li>commons-collections-3.1.jar</li>
  <li>commons-digester-1.7.jar</li>
  <li>commons-el-1.0.jar</li>
  <li>commons-fileupload-1.0.jar</li>
  <li>commons-lang-2.1.jar</li>
  <li>commons-logging-1.0.4.jar</li>
  <li>commons-validator-1.1.4.jar</li>
  <li>jsf-api-1.2.jar</li>
  <li>jsf-impl-1.2-NIGHTLY_20060227.jar</li>
  <li>jstl-1.1.2.jar</li>
  <li>oro-2.0.8.jar</li>
  <li>xml-apis-1.0.b2.jar</li>
  </ul>
  
  <p>In JBoss 4.2.2GA (customised for JSF) I deployed the war its running but when I am trying to go to the url <a href="http://localhost:8080/FBApp/" rel="nofollow noreferrer">http://localhost:8080/FBApp/</a> the page is rendered as:</p>
  
  <p><img src="https://i.stack.imgur.com/1vK8e.png" alt="ERROR"></p>
  
  <p>which is actually the code of inputname.jsf. What I am doing wrong? Any information will be appreciable.</p>
  
  <p>Thanks and regards.</p>
  
  <hr>
  
  <p>Edit:
  Code changed as instructed by <a href="https://stackoverflow.com/users/157882/balusc">BalusC</a>. Now I am getting exception and the stacktrace:</p>
  
  <pre><code>19:34:04,244 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
  java.lang.NullPointerException
      at com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:162)
      at org.apache.jsp.pages.inputname_jsp._jspx_meth_f_005fview_005f0(inputname_jsp.java:104)
      at org.apache.jsp.pages.inputname_jsp._jspService(inputname_jsp.java:77)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
      at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694)
      at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665)
      at org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      at java.lang.Thread.run(Thread.java:636)
  19:34:04,245 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
  java.lang.NullPointerException
      at com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:162)
      at org.apache.jsp.pages.inputname_jsp._jspx_meth_f_005fview_005f0(inputname_jsp.java:104)
      at org.apache.jsp.pages.inputname_jsp._jspService(inputname_jsp.java:77)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
      at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694)
      at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665)
      at org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      at java.lang.Thread.run(Thread.java:636)
  </code></pre>