I have a very strange problem in JSF page that I cannot solve. I have this html doctype declaration into the xhtml page:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<ui:insert name="header">
<ui:include src="header.xhtml"/>
</ui:insert>
</h:head>
<h:body>
When I run the JSF page and I open Furebug to the page code I get this:
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
</html>
It should be like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
</html>
I don't know why the html doctype is skipped? Can you help me to fix this?
P.S I use JSF navigation to navigate to the new page:
<h:commandButton id="newdatacenter" styleClass="lbimage" value="New Datacenter" action="#{DatacentersController.navigateToNewDatacenter()}">
// <f:ajax render="@form"></f:ajax>
</h:commandButton>
// Navigate to New Datacenter page
public int navigateToNewDatacenter(){
return 11432;
}
<navigation-rule>
<description>Navigation rule to New Datacenter page</description>
<from-view-id>/DatacentersList.xhtml</from-view-id>
<navigation-case>
<from-action>#{DatacentersController.navigateToNewDatacenter()}</from-action>
<from-outcome>11432</from-outcome>
<to-view-id>/NewDatacenter.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
I don't know why when the new JSF page is opened the HTML doctype declaration is not included.