The jsp:root element represents the root element of a JSP document. A jsp:root element is not required for JSP documents. You can specify your own root element, enabling you to use any XML document as a JSP document. The root element of the books.jspx example JSP document is books.
Although the jsp:root element is not required, it is still useful in these cases:
When you want to identify the document as a JSP document to the JSP container without having to add any configuration attributes to the deployment descriptor or name the document with a .jspx extension
When you want to generate, from a single JSP document, more than one XML document or XML content mixed with non-XML content
The version attribute is the only required attribute of the jsp:root element. It specifies the JSP specification version that the JSP document is using.
The jsp:root element can also include xmlns attributes for specifying tag libraries used by the other elements in the page.
The books.jspx page does not need a jsp:root element and therefore doesn’t include one. However, suppose that you want to generate two XML documents from books.jspx: one that lists books and another that lists magazines (assuming magazines are in the database). This example is similar to the one in the section Including Directives in a JSP Document. To do this, you can use this jsp:root element:
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" > <books>...</books> <magazines>...</magazines> </jsp:root>
Notice in this example that jsp:root defines the JSP namespace because both the books and the magazines elements use the elements defined in this namespace.