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"
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).