| Sign In/My Account | View Cart |
Writing JSPs in XML using JSP 1.2
Pages: 1, 2
The page directive is used to define a number of page-dependent properties and pass these values to the container. This element must appear at the beginning of the JSP document.
JSP syntax:
<%@ page page_directive_attr_list %>
XML syntax:
<jsp:directive.page page_directive_attr_list />
The include directive is used to substitute text and/or code at JSP translation time. A JSP in either syntax can use the include directive to include another JSP written in either syntax. This element can appear anywhere within a JSP document.
JSP syntax:
<%@ include file="relativeURL" %>
XML syntax:
<jsp:directive.include file="relativeURL" />
An interesting point to make: the XML view of a JSP page does not contain jsp:directive.include elements; rather, the included file is expanded in place. This is done to simplify validation.
The declaration element is used to declare scripting-level constructs that are available to all other scripting elements. This element does not have any attributes and the body of the element is the declaration(s).
JSP syntax:
<%! declaration(s) %>
XML syntax:
<jsp:declaration>declaration(s)</jsp:declaration>
The scriplet element is used to insert fragments of code. This element does not have any attributes and the body of the element is the program fragment.
JSP syntax:
<% code fragment %>
XML syntax:
<jsp:scriptlet>code fragment</jsp:scriptlet>
The expression element is used to describe complete expressions that get evaluated at run-time. This element does not have any attributes and the body of the element is the expression.
JSP syntax:
<%= expression %>
XML syntax:
<jsp:expression>expression</jsp:expression>
The standard and custom action elements were defined in XML syntax prior to the 1.2 specification. Just as a reminder, the standard actions include:
The text element is used to enter template data into a JSP document. This element does not have any attributes and the body of the element is the template data. The XML syntax of this element is: <jsp:text>template data</jsp:text>. When this element is interpreted, the body is passed through to the current value of out. This element is very similar to the XSLT xsl:text element.
JSP documents provide many benefits, including the ability to validate JSPs and to manipulate them with XML-aware tools. They behave the same way a traditional JSP does, by generating a response stream of characters from template data and dynamic data. JSP documents even contain many of the same types of elements, just now in XML syntax. This is one of the great additions to the JSP 1.2 specification, and I think it will play more and more of a role as the specification and developer community mature.
Stephanie Fesler is a BEA Systems expert on implementing various Java 2EE API.
Return to ONJava.com.
Showing messages 1 through 10 of 10.
how to create dynamic xml in java?
criteria:-
am creating jsp,it,s calls the Action class from Action class i call the DAO after getting the results stored in ArrayList,using these vlues create the Xml file that file store in to define location.
please tell me the how to generate for this code.