Here is an example of an XML declaration:
<?xml version="1.0" encoding="UTF-8" ?>
This declaration is the default XML declaration. It means that if the JSP container is generating an XML declaration, this is what the JSP container will include in the output of your JSP document.
Neither a JSP document nor its request output is required to have an XML declaration. In fact, if the JSP document is not producing XML output then it shouldn’t have an XML declaration.
The JSP container will not include the XML declaration in the output when either of the following is true:
You set the omit-xml-declaration attribute of the jsp:output element to either true or yes.
You have a jsp:root element in your JSP document, and you do not specify omit-xml-declaration="false" in jsp:output.
The JSP container will include the XML declaration in the output when either of the following is true:
You set the omit-xml-declaration attribute of the jsp:output element to either false or no.
You do not have a jsp:root action in your JSP document, and you do not specify the omit-xml-declaration attribute in jsp:output.
The books.jspx JSP document does not include a jsp:root action nor a jsp:output. Therefore, the default XML declaration is generated in the output.