The Java EE 5 Tutorial

Turning On Validation of XML Files

Your application contains one or more application configuration resource files written in XML. You can force the JavaServer Faces implementation to validate the XML of these files by setting the validateXML flag to true.

    To set the flag using NetBeans IDE, do the following:

  1. Expand the node of your project in the Projects pane.

  2. Expand the Web Pages and WEB-INF nodes that are under the project node.

  3. Double-click web.xml.

  4. After the web.xml file appears in the editor pane, click General at the top of the editor pane.

  5. Expand the Context Parameters node.

  6. Click Add.

  7. In the Add Context Parameter dialog:

    1. Enter com.sun.faces.validateXml in the Param Name field.

    2. Enter true in the Param Value field.

    3. Click OK.

    To set the flag in the deployment descriptor directly, do the following:

  1. Add a context-param element to the deployment descriptor.

  2. Add a param-name element inside the context-param element and give it the name com.sun.faces.validateXml.

  3. Add a param-value element to the context-param element and give it the value true. The default value is false.