Decorator Filter ver. 1.3

This is a Java servlet filter (as per Servlet API 2.3). DecoratorFilter lets you add dynamically (on the fly) some content to the serviced requests. More precisely filter adds content from the given file before or after the given HTML tag (e.g. before the body tag, or after the head tag etc.)

How to use it:

a) download decoratorflt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml. There is one mandatory initial parameter data describes your file (e.g. with CSS or Javascript) and three optional parameters. Parameter tag describes a tag. Default value is body. Parameter place describes a place for new content (relatively to the given tag). Possible values are before, after or inside. Default value is before. Parameter encoding describes an encoding for data. Default value is UTF-8.


c) describe a mapping for this filter in web.xml


in this case filter will be on for the each .jsp file

And now when you invoke any .jsp page: http://your_host/your_page.jsp DecoratorFilter will insert data from your file into output before sending it to the client.

    For downloading:   decoratorflt.jar

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: