com.caucho.jsp
Class XtpManager

java.lang.Object
  |
  +--com.caucho.jsp.PageManager
        |
        +--com.caucho.jsp.XtpManager

public class XtpManager
extends PageManager

Manages XTP templates. The XtpManager allows for a template style of XTP. A servlet can use XTP for its output.

The template API lets servlets assign implicit script variables for JavaScript. Filling up a HashMap with the variable name will do the trick.

An example servlet may look something like the following. If the stylesheet or the generated JSP file use JavaScript, testObject will be assigned to the global variable "test".


 void service(ServletRequest req, ServletResponse res)
 {
   // do some processing here

   // get the XTP template
   XtpManager manager =  XtpManager.getManager(getServletContext());
   Page page = manager.createPage("WEB-INF/xtp/test.xtp");

   // fill in implicit variables (optional)
   HashMap vars = new HashMap();
   vars.put("test", testObject);

   // execute the template
   page.service(req, res, vars);
 }
 

See Also:
Page

Fields inherited from class com.caucho.jsp.PageManager
autoCompile, workPath
 
Method Summary
static XtpManager getManager(ServletContext context)
          Returns the XTP manager for the given ServletContext.
 void setEntitiesAsText(boolean entitiesAsText)
          If true, parse XML with entities as text
 void setStrictXml(boolean strictXml)
          Requires XTP documents conform to strict XML.
 void setStrictXsl(boolean strictXsl)
          Requires XTL stylesheets to conform to strict XSL.
 void setToLower(boolean toLower)
          If true, HTML tags are normalized to lower-case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setStrictXml

public void setStrictXml(boolean strictXml)
Requires XTP documents conform to strict XML. If false (the default), XTP files are loose HTML.

setStrictXsl

public void setStrictXsl(boolean strictXsl)
Requires XTL stylesheets to conform to strict XSL. If false (the default), XTP files follow the XSLT-lite syntax.

setToLower

public void setToLower(boolean toLower)
If true, HTML tags are normalized to lower-case.

setEntitiesAsText

public void setEntitiesAsText(boolean entitiesAsText)
If true, parse XML with entities as text

getManager

public static XtpManager getManager(ServletContext context)
                             throws RegistryException
Returns the XTP manager for the given ServletContext.