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
Method Summary |
static XtpManager |
getManager(ServletContext context)
Returns the XTP manager for the given ServletContext. |
void |
setStrictXml(boolean strictXml)
Requires XTP documents conform to strict XML. |
void |
setStrictXsl(boolean strictXsl)
Requires XTL stylesheets to conform to strict XSL. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
getManager
public static XtpManager getManager(ServletContext context)
- Returns the XTP manager for the given ServletContext.