Tuesday, April 21, 2015

Java Server Faces can't live without javax.faces.webapp.FacesServlet

Just a simple little web page developed using Primefaces but it doesn't show up. How simple it is? See below:
<h:body>
   <h:form>
      <h:outputlabel value="First value: "/>
      <p:inputtext id="first"/>
   </h:form>
</h:body>
Why the UI component doesn't render it well is actually I left out the following piece in web.xml:
<servlet>
   <servlet-name>Faces Servlet</servlet-name>
   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
   <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
   <servlet-name>Faces Servlet</servlet-name>
   <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
My final word is the above piece is very important. Java Server Faces can't live without that piece.

No comments: