XSP is a dynamic markup language like JSP (Java Server Pages) or ASP (Active Server Pages) that providing code embedding directives. But far more powerfull. It is tightly integrated to Cocoon.

An XSP document is a XML document with special XSPSyntax. A XSP document can be used as the starting point of a Pipeline. The XSP is processed by a special Cocoon Generator called ServerPagesGenerator.

The XSP processor of the ServerPagesGenerator converts the XSP document into a source program for a particular target processing language. Currently you can use XSP to generate source programs in Java, Javascript and Python.

Upon execution of the generated program, the resulting XML document described by the original XSP document will be generated, interspersed with dynamic content generated by the code extracted from the XSP tag directives.

There are 3 roles here:

Shortly, an XSP document (XSP page) is used by the ServerPagesGenerator to create a XML document.

The image below shows in detail the process the XSP Compile Pipeline in pink:

  1. The Generator reads XSP page and then turns it into target source code (for example java code) using XSLT transformations.

  2. Compile the generated code and
  3. Invokes the compiled code.

XSP Processing Pipeline

Note: "while XSP provides an abstraction for the different aspects of a page, i.e. the logic, expression, etc. The contents of these are still language specific. So essentially they only provide hooks to allow these to be generated easily. Not a pure language abstraction."

Using XSP

The generated source code of your XSP pages will be placed placed in:

$CATALINA_HOME/work/localhost/web-app-name/cocoon-files/org/apache/cocoon/www

with the base below that depending on the directory path under $COCOON_HOME. Classes are renamed from XXX.xsp to XXX_xsp.java. Test Added by Yogesh

XSPFundamentals (last edited 2009-09-20 23:39:58 by localhost)