InformationWeek: The Business Value of Technology

InformationWeek: The Business Value of Technology
InformationWeek - Our New iPad App
News

May 22, 2000

Printer ready
Printer ready

XML Server Pages Vs. Java Server Pages

Cocoon's XML Server Pages can keep program logic separate from output format.

Java Server Page (JSP)
Output format, specified by the out.println statements below, are mixed with program logic

<jsp:scriplet>
Š..
</jsp:scriplet>
<list>
<title>Servlet Parameters</title>
<jsp:scriplet>
Š..
request.getParameterValues(k);
out.println("<element name=\"name\">");
</jsp:scriplet>
<jsp:expression>k</jsp:expression>
<jsp:scriplet>
out.println("</element>");
for(int i = 0; i < vals.length; i++) {
</jsp:scriplet>
<item> <jsp:expression>vals[i]</jsp:
expression>
</item>
ŠŠ
</jsp:scriplet>

DATA: APACHE SOFTWARE FOUNDATION

XML Server Page (XSP)
The division between content and logic is clear in the code fragment below. A separate XSL style sheet is used to format the output

<xsp:logic>
Š..
<xsl:content>
<list>
<title>Servlet Parameters</title>
<xsp:logic>
Š..
request.getParameterValues(k);
<xsp:element name="element">
<xsp:attribute name="name">
<xsp:expr>k</xsp:expr>
</xsp:attribute>
<xsp:logic>
for(int i = 0; i < vals.length; i++) {
<item>
<xsp:expr>vals[i]</xsp:expr>
</item>
ŠŠ
</xsp:logic>

Return to main story, "Cocoon: Sanity For Web-Site Management."

Back to This Week's Issue
Send Us Your Feedback
Top of the Page

Get InformationWeek Daily

Don't miss each day's hottest technology news, sent directly to your inbox, including occasional breaking news alerts.

Sign up for the InformationWeek Daily email newsletter

*Required field

Privacy Statement



This Week's Issue

Technology Whitepapers

Featured Reports







Video