Tutorial Home
Hibernate
StrutsJSP
Spring
|
SCWCD : JSP Document (XML-based document) that uses the correct syntax
JSP syntax comment: <%-- comment --%>has no XML syntax analog. JSP syntax page directive: <%@ page ... %> XML syntax page directive: <jsp:directive.page ... /> JSP syntax taglib directive: <%@ taglib ... %>has no XML syntax analog. jsp:root element is annotated with namespace information: <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="2.0"> ... </jsp:root> A taglib directive of the form <%@ taglib uri="uriValue" prefix="prefix" %>is translated into an xmlns:prefix attribute on the root of the JSP document, with a value that depends on uriValue.
<%@ taglib tagdir="tagDirValue" prefix="prefix" %>is translated into an xmlns:prefix attribute on the root of the JSP document, with a value of the form urn:jsptagdir:tagDirValue. JSP syntax include directive: <%@ include file="relativeURL" %> XML syntax include directive: <jsp:directive.include file="relativeURL" />A file on the local system to be included when the JSP page is translated into a servlet. The URL must be a relative one. JSP syntax declaration: <%! ... %> XML syntax declaration: <jsp:declaration> ... </jsp:declaration> Declarations are translated into a jsp:declaration element. For example:
<%!
public String someFunc(int i) {
if (i<3) return("...");
}
%>
is translated into the following:
<jsp:declaration>
<![CDATA[
public String someFunc(int i) {
if (i<3) return("...");
}
]]>
</jsp:declaration>
Alternatively, we could use an < and instead say:
<jsp:declaration>
public String someFunc(int i) {
if (i<3) return("...");
}
</jsp:declaration>
JSP syntax scriptlet: <% ... %> XML syntax scriptlet: <jsp:scriptlet> ... </jsp:scriptlet> JSP syntax expression: <%= ... %> XML syntax expression: <jsp:expression> ... </jsp:expression> JSP syntax template text: some template text XML syntax template text: <jsp:text> some template text </jsp:text> A JSP document syntax: <html> <title>positiveTagLib</title> <body> <%@ taglib uri="http://java.apache.org/tomcat/examples-taglib" prefix="eg" %> <%@ taglib uri="/tomcat/taglib" prefix="test" %> <%@ taglib uri="WEB-INF/tlds/my.tld" prefix="temp" %> <eg:test toBrowser="true" att1="Working"> Positive Test taglib directive </eg:test> </body> </html> A XML document syntax: <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="2.0"> <jsp:text><![CDATA[ <html> <title>positiveTagLib</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> |
SCJP 6.0 Simulator 664+ Questions With Explanations
SCWCD 5.0 Simulator 556+ Questions With Explanations
SCWCD 4.0 Simulator 500+ Questions With Explanations
OCA 10g Simulator 594+ Questions With Explanations
Subscribe to PMP_FOURTH_EDITION
Subscribe to techfaq360
