Saturday, February 4, 2012

HTML DTD for ICE faces JSPX


Resolving the browser compatibility issues while developing the web applications is a bit complex. Most of the times developer tries to write the browser specific code. But, it is not possible to implement the browser specific code for all the pages of the application in all the scenarios and it is not required if we specify the DOCTYPE. Specifying the doctype for the page will decrease the most of the browser compatibility issues.


A doctype declaration refers to the rules for the markup language, so that the browsers render the content correctly.


The doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in.
The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers render the content correctly.


The doctype declaration should be the very first thing in an HTML document, before the tag.


There are different DTDs for the HTML page as specified below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/transitional.dtd">



Specifying the DTD on JSF page which developed using ICE faces might not accept as you specify on the normal HTML page. You have to place it after the declaration of f:view tag.



<jsp:root version="2.1" xmlns:jsp="http://java.sun.com/JSP/Page"          xmlns:f="http://java.sun.com/jsf/core"          xmlns:h="http://java.sun.com/jsf/html"          xmlns:ice="http://www.icesoft.com/icefaces/component">   
<jsp:directive.page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"/>   
<f:view>   
<ice:outputDeclaration doctypeRoot="HTML" doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN" doctypeSystem="http://www.w3.org/TR/html4/strict.dtd" />
<!-- Place the required code here --> 
</f:view>
</jsp:root>


Click here To Read more about fixing the browser compatibility issues.

No comments: