Top Qs
Timeline
Chat
Perspective
EXtensible Server Pages
From Wikipedia, the free encyclopedia
Remove ads
eXtensible Server Pages (XSP) is an XML‑based server‑side language designed to embed Java code within XML documents. It was created by the Apache Software Foundation as part of the Apache Cocoon web‑publishing framework. XSP emphasizes the strict separation of content, logic, and presentation.[1]
History and purpose
XSP originated in **Cocoon 1.x** and evolved into a core component of **Cocoon 2.x**, enabling dynamic XML generation at request time.[2] It serves as a generator in Cocoon’s pipeline, translating XML templates with embedded Java into SAX-based content producers.[3] Academic tutorials—such as those from NYU and IBM developerWorks—cover XSP, demonstrating its use in technical education.[4]
Architecture and features
- XSP files begin with an `<xsp:page>` root element, often specifying `language="java"` and the XSP namespace.[5]
- Java logic lives inside `<xsp:logic>` tags, while expressions go inside `<xsp:expr>` tags. These are compiled on demand into Java-based Cocoon producers.[6]
- XSP supports tag libraries (“logicsheets”) for reusable components; Cocoon includes built-in logicsheets and supports user-defined ones.[7]
- Generated XML can be passed through XSLT in Cocoon’s pipeline.[8]
Remove ads
Example
<?xml version="1.0"?> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"> <xsp:logic> static private int counter = 0; synchronized int count() { return counter++; } </xsp:logic> <page> <p>Request number <xsp:expr>count()</xsp:expr>.</p> </page> </xsp:page>
This generates XML displaying an incrementing request counter.[9]
Notability
- Developed and maintained by the Apache Software Foundation as an official component of the Cocoon project.[10]
- Covered in developer‑focused publications such as IBM developerWorks and widely used in university coursework.[11]
- Featured in O’Reilly’s *Java & XML* book as a significant Cocoon component.[12]
Use cases and adoption
Comparison with JSP
Though similar to JavaServer Pages in blending markup and Java, XSP differs by:
Lifecycle status
Once central to Cocoon development, XSP is now largely part of a “legacy” stack. Usage has declined with Cocoon’s waning popularity, though systems like Lenya still use it.[17]
References
External links
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads