Global pages taglib ver. 1.3

    Custom JSP taglib. This taglib lets you use something similar to global-forwards in Struts. The main idea is very simple. Instead of using the hard coded strings for pages in jsp:forward and jsp:include tags you can use the similar tags from this taglib where the page will be defined as a global (context) parameter for your web application. For example, in your web.xml file you can define a context parameter error:
 


<context-param>
 <param-name>error</param-name>
 <param-value>/myerrorpage.jsp</param-value>
</context-param>

This parameter defines a real location for your page. And later in your application you can use this symbolic name error in your tags:
 


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

<g:forward page="error"/>

so this indirect reference lets you update your application much more easily. If ever you decide to change the target page that you use for these forwards you then only need to change the definitions in one file (web.xml).

Tags are:

forward

forwards request to the the given page. Parameters are:

1) page Describes a name for context parameter.
2) cond Optional attribute. Describes a boolean value tag's behavior depends on. Default value is true (forward).

redirect

redirects request to the the given page. Parameters are:

1) page Describes a name for context parameter.
2) cond Optional attribute. Describes a boolean value tag's behavior depends on. Default value is true (redirect).

include

includes the given page. Parameters are:

1) page Describes a name for context parameter.
2) flush Optional parameter. Possible values are true or false. Describes a toggle for buffer flushing. Default value is false.
3) cond Optional attribute. Describes a boolean value tag's behavior depends on. Default value is true (include).

for downloading:

Library: globtag.jar    Description: taglib.tld

© Coldbeans      Comments?

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

Also in Coldtags: