aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes XML VIEW OF JSP PAGE: Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "XML VIEW OF JSP PAGE:" Watch "XML VIEW OF JSP PAGE:" New topic
Author

XML VIEW OF JSP PAGE:

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
This is from jsp spec
Why <![CDATA is being used ???
cant i just say
<jsp:text><title>asdasd<title></jsp:text>
XML VIEW OF JSP PAGE:
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:eg="http://java.apache.org/tomcat/examples-taglib"
xmlns:test="urn:jsptld:/tomcat/taglib"
xmlns:temp="urn:jsptld:/WEB-INF/tlds/my.tld"
version="1.2">
<jsp:text><![CDATA[<html>
<title>positiveTagLig</title>
<body>
]]></jsp:text>
<eg:test toBrowser="true" att1="Working>
<jsp:text>Positive test taglib directive</jsp:text>
</eg:test>
<jsp:text><![CDATA[
</body>
</html>
]]></jsp:text>
</jsp:root>
Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
hi can u tell me how to use xml syntax with jsp
for example
<%="hello"%>
<%
int i=0;
%>
<% int i=0;%>
<% for(i=0;i<8;i++)
{%>
out.println(<%=i%> ;
<%
}
%>
<%="hello2"%>
gives the output
hello int i=0; out.println(0); out.println(1); out.println(2); out.println(3); out.println(4); out.println(5); out.println(6); out.println(7); hello2
but if i try with xml syntax
<jsp:expression>
"hello"
</jsp:expression>
<jsp:scriptlet>
int i=0;
</jsp:scriptlet>
<jsp:scriptlet> for(i=0;i<8;i++)
{</jsp:scriptlet>
out.println(<jsp:expression>i</jsp:expression> ;
<jsp:scriptlet>
}
</jsp:scriptlet>
it gives weird output
"hello" int i=0; for(i=0;i<8;i++) { out.println(i); }
how u r doing it with xml?


SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by shan java:
Why <![CDATA is being used ???

Because the XML contained in it isn't well-formed -- it contains XML opening tags "html" and "body" without corresponding closing tags. By using a CDATA section you tell the HTML parser to treat the content as flat character data, not as XML.
cant i just say
<jsp:text><title>asdasd<title></jsp:text>
Yes you can, as this is well-formed XML.
If you are unsure about the concept of well-formedness I'd recommend you read a good XML tutorial; you won't properly understand JSP XML format unless you understand XML.
- Peter
[ April 11, 2002: Message edited by: Peter den Haan ]
 
 
subject: XML VIEW OF JSP PAGE:
 
Threads others viewed
info attribute of page directive
JSP not being generated properly with SAX
JSP Documents, EL and CDATA construct
JSF Components does not appear on the browser
JSPs as XML documents, but no HTML rendered!
developer file tools