ServletSpeedster Web, generated: 2004-04-19 18:55 [EEST]  

Hosted by Logo
Web created with:


This is a little tutorial for getting you started.

Step 1 - analyze your servlet or jsp page

     At first take a look at your servlet or jsp page, try to split into independent blocks so that source in one block would in no way affect the code in another block. A good example of an independent block could be a menu block or a news block.

Step 2 - split your servlet or jsp page.

     Create individual jsp pages or servlets that generate the output of the independent blocks you created.
Check that their output is correct before going to the next step.

Step 3 - Create the including jsp/servlet.

     Now create the servlet that includes them (see the servlet api, jsp specification how to do it or take a look at servletspeedster documentation page.) and check if the output of the servlet/jsp you created with dynamic inclusions is correct.
Some buggy jsp implementations may need an out.flush(); to be called before any inclusion or the output will be not what you would expect it to be.

Step 4 - Create the SpeedsterServlet configuration.

     Create the speedster servlet configuration for your future cacheable pages, choose the rule that suites you the best.
The time based rule is more suited for time dependant caching like getting an rss feed after each 10 minutes and creating some output from it.
The event based rule is more suited for caching data that is generated by your web application, for example if you show a news list(which should be cached) and insert the news to it by a form which works on a servlet backend, then the servlet that modifies/adds/deletes news can fire events to the cache that something has changed.
If you create a rule of your own by extending the SpeedsterRule class, you'll probably figure out by yourself where and how to use it.

Step 5 - Create the servlet mappings for cacheable pages.

     Create servlet mappings as showed in the documentation for the pages you want to cache. For the simplicity i advise you to hide them all between a certain path like /cached/<original_page_name>, for example make "/left.jsp" be mapped as "/cached/left.jsp" .

Step 6 - Replace includable page names.

     So while you originally included <pagename> into your jsp or servlet, replace the name now with the one you created the mapping for.
As an example <jsp:include page="/left.jsp"/> should be replaced by <jsp:include page="/cached/left.jsp"/>.
See how your page looks now. If the output seemes okay, you can slowly start tuning the parameters the ServletSpeedster caches were configured with so you can get the best performance out of it.
If you run into trouble somewhere, please refer to the example application shipped with ServletSpeedster and it's configuration.
Illustrative picture

End of tutorial.