This installation guide shows you how to configure OSCache for use inside your JSP pages. It assumes you have downloaded the latest version (available here).

If you intend to use OSCache via the API rather than via the taglibs, these instructions do not apply. Just make sure oscache.jar is somewhere on your application's classpath.

Extraction Steps

Extract the downloaded file to a directory of your choosing.

Put the /oscache.jar file in the /WEB-INF/lib directory

Make sure commons=logging.jar is on your classpath (normally this also means putting it in /WEB-INF/lib.

If you are using JDK 1.3.x it is optional, but strongly recommended, to add commons-collections.jar to your classpath. OSCache will use this to provide a significant speed increase. (Note that with JDK 1.4 and higher, commons-collections.jar will not be used - the 1.4 implementation is faster still).

Put the /src/oscache.properties file in the /WEB-INF/classes directory and edit the properties contained within it (for example if you want disk caching, configure the persistence listener and edit the cache.path property to point to where you want the cache files stored on disk). See the Configuration Guide for further details on what options are available.

Remember to escape any \ characters in Windows paths - ie if you want cache files to go in c:\cachedir, the cache.path property should be set to c:\\cachedir.

Put the /src/META-INF/taglib.tld file in your /WEB-INF/classes directory. You can rename this to oscache.tld if you have any conflicting tld files.

Your directory structure should now look something like this:

$WEB_APPLICATION\WEB-INF\lib\oscache.jar
$WEB_APPLICATION\WEB-INF\classes\oscache.properties
$WEB_APPLICATION\WEB-INF\classes\taglib.tld

Installation Steps

Add the following to your web.xml file

<taglib>
      <taglib-uri>oscache</taglib-uri>
      <taglib-location>/WEB-INF/classes/taglib.tld</taglib-location>
</taglib>

Now add the appropriate tags to your JSP files and you're done.

It should work properly. Tell us on the mailing list if it doesn't work in your container.

Logging and Debugging

OSCache now uses Jakarta Commons Logging for logging any messages. Please see the Commons Logging documentation for details on logging configuration.

Note that OSCache has been compiled with debugging information enabled so you should be able to use your favourite debugger to step through the source if need be.