Java Reference
In-Depth Information
web.xml is the standard, optional configuration file needed for Java web
applications, this file became optional in version 3.0 of the Servlet API, which was
introduced with Java EE 6. In many cases, web.xml is not needed anymore, since
most of the configuration options can now be specified via annotations. For JSF
applications, however, it is a good idea to add one, since it allows us to specify the
JSF project stage .
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<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>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
As we can see, NetBeans automatically sets the JSF project stage to Development ,
setting the project stage to development configures JSF to provide additional
debugging help not present in other stages. For example, one common problem
when developing a page is that while a page is being developed, validation for
one or more of the fields on the page fails, but the developer has not added an
<h:message> or <h:messages> tag to the page (more on this later). When this
happens and the form is submitted, the page seems to do nothing, or page navigation
doesn't seem to be working. When setting the project stage to Development, these
validation errors will automatically be added to the page, without the developer
having to explicitly add one of these tags to the page (we should, of course, add
the tags before releasing our code to production, since our users will not see the
automatically generated validation errors).
 
Search WWH ::




Custom Search