logo
Support This Project

Installation

A good starting point for JSP development is Hello World JSP.

For Velocity read Hello World Velocity.

ztemplates is a Filter.

Configuration

(since 1.0.0)

ztemplate scans the classpath at startup for annotated classes. If your application contains many jars this is time-consuming. You may wish to speed things up by providing a filter that only includes jars and classes you need.

Do it as follows to ensure that the default ztemplates classes are included.

The default implementation only scans WEB-INF/lib and WEB-INF/classes.

ZClassPathFilter has changed to ZIClassPathFilter, note the 'I'

If no filter can be found ztemplates prints a warning to the console, so check the console to see if the filter is used or not.

    <context-param>
      <param-name>ZIClassPathFilter</param-name>
      <param-value>com.mycompany.MyClassPathFilter</param-value>
      <description>
      	Restrict classpath scan to jars/classes known to contain ztemplates-relevant classes.
      	Best MyClassPathFilter extends ZDefaultClassPathFilter
      </description>
    </context-param>

public class MyClassPathFilter extends ZDefaultClassPathFilter
{
  @Override
  public boolean acceptClass(String namethrows Exception
  {    
    //include the default ztemplates classes
    if(super.acceptClass(name))
    {
      return true;
    }
    
    //include your own classes here
    return name.startsWith("com.mycompany");
  }
}

The default implementation only scans WEB-INF/lib and WEB-INF/classes. To add more locations override acceptClasspathPart.

public class MyClassPathFilter extends ZDefaultClassPathFilter
{
  @Override
  public boolean acceptClasspathPart(String namethrows Exception
  {    
    //include the defaults
    if(super.acceptClasspathPart(name))
    {
      return true;
    }
    
    //include your own classpath locations here
    return ...;
  }
}

  My Prefs Log in
This page (revision-) last changed by gerdziegler.de.
 
(c) 2007 gerdziegler.de
JSPWiki v2.4.69