File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes XML view and JSP Document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "XML view and JSP Document" Watch "XML view and JSP Document" New topic

XML view and JSP Document

George Pavamani
Ranch Hand

Joined: Jan 31, 2002
Posts: 31
I am totally new to XML.Can anybody explain to me in plain terms what is the difference between a XML view and JSP Document??
Thanks in advance
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

From the JSP 1.2 specification:
Section 5: JSP Documents
"This chapter defines an XML syntax for JSP pages and the interpretation of the pages written in this syntax. We use the term JSP document to refer to a JSP page in XML syntax.
This chapter also defines a mapping between any JSP page and an XML description of the page, its XML view. The XML view is defined for JSP pages writtin in JSP and in XML syntax."
1st thing you need to know about JSPs to understand is the process involved in running a JSP. the JSP page is first translated into XML, then from XML to a Java Servlet and then compiled into a .class. That translated XML step is the XML view.
You also have the option of writing your JSP page in the XML syntax. This would make it a JSP document.
Here's where the real question gets answered:
"JSP.5.3.1. JSP Documents
The XML view of a JSP page written in XML syntax [a JSP Document] is very close to the original JSP page. Only two transformations are performed:
* Expand all include directives into the JSP fragments they include.
* If the JSP container supports the jsp:id attribute, add the attribute."
Often times an app server will give you the option of saving the generated .xml, .java and .class files from a JSP. Play with it a bit and see what the differences are in the JSP Document vs XML View.
Hope that helps!!

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
George Pavamani
Ranch Hand

Joined: Jan 31, 2002
Posts: 31
Thanks a lot Jessica for the reply. It really helped me a lot.
Thanks a lot again

I agree. Here's the link:
subject: XML view and JSP Document
It's not a secret anymore!