Resource taglib 1.3


    Custom JSP taglib. This taglib lets you scan and read resources in your web applications.

For example:
 


<%@ taglib uri="taglib.tld" prefix="r" %>

<!-- list resources in / (root directory) -->
<r:forEachResource path="/">
  <br><%=resourceName%>
</r:forEachResource>

<!-- get index.jsp -->
<r:getResource path="/index.jsp" id="A"/>

Here tag forEachResource lets you iterate over existing resources for the given path. Nested variable resourceName describes a current resource. Tag getResource is actually a wrapper for getResourceAsStream() operation.

Tags are:

forEachResource

Body tag executes own body for the each resource. Parameters are:

1) pathOptional parameter. Describes a path for lookup. Default value is /

getResource

Body tag reads and prints (saves in the page scope variable) resource file. Tag's body describes a default resource. Parameters are:

1) path describes a path for your resource.
2) id Optional parameter. Describes a name for the page scope variable. (type is java.lang.String). Without this parameter tag just prints data.

for downloading:

Library: resourcetag.jar    Description: taglib.tld

 © Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.

Also in Coldtags: