Custom JSP taglib lets you deploy Ajax approach in your application.
Tag AjaxDiv lets you define an area in your HTML code that will be periodically
updated through asynchronous HTTP requests. For example:
In the above mentioned example tag will request the file newContent.jsp and update your area every 10 seconds. In order to use this tag you have to describe an external JavaScript file cjajax.js on your page.
You can directly update your area (right from JavaScript) via the following call: update_idForYourArea(). E.g. in the above mentioned example (area id is i1) this call looks so: update_i1().
Timeout (in case of setting this parameter in tag) will be available through the JavaScript variable timer_idForYourArea. E.g. in the above mentioned example (area id is i1) you can stop process by this call: clearTimeout(timer_i1).
Also you can provide your own JavaScript function for error reports. E.g.:
An optional parameter handler lets you provide your own JavaScript function that will accept the requested data.
This function will get two parameters: obtained text and obtained XML document:
Attributes beforeAction and afterAction lets you provide your own JavaScript code that marks start/end phase of request. For example you can show/hide here some loading image etc.
Tag AjaxScrollArea lets you add request content to some area.
For example:
Tags are:
AjaxDiv
Body tag defines a div block updated via Ajax call. Parameters are:
1) id Describes a CSS (DHTML) id.
2) url Describes an URL for your requests.
3) className Optional parameter. Describes your own CSS class for this area.
4) style Optional parameter. Describes your own CSS style for this area.
5) timeout Optional parameter. Describes a timeout for the periodical calls (in seconds).
6) error Optional parameter. Describes a name for your own JavaScript function that will be called in case
of errors. By default is empty.
7) handler Optional parameter. Describes a name for your own JavaScript function that will accept the requested content.
By default this function updates (replaces) content in the described area.
8) beforeAction Optional parameter. Describes a name for your own JavaScript function that will be called at the beginning
of request. By default is empty.
9) afterAction Optional parameter. Describes a name for your own JavaScript function that will be called at the end of request. By default is empty.
AjaxScrollArea
Body tag defines a scrollable div block updated via Ajax call. Parameters are:
1) id Describes a CSS (DHTML) id.
2) url Describes an URL for your requests.
3) className Optional parameter. Describes your own CSS class for this area.
4) style Optional parameter. Describes your own CSS style for this area. Default value is overflow:auto.
5) timeout Optional parameter. Describes a timeout for the periodical calls (in seconds).
6) error Optional parameter. Describes a name for your own JavaScript function that will be called in case
of errors. By default is empty.
7) beforeAction Optional parameter. Describes a name for your own JavaScript function that will be called at the beginning
of request. By default is empty.
8) afterAction Optional parameter. Describes a name for your own JavaScript function that will be called at the end of request. By default is empty.
9) direction Optional parameter. Possible values are up and down. Describes how (where) to add new content
relatively existing data. Default value is down.
for downloading:
Library: ajaxdivtag.jar Description: taglib.tld JavaScript library: cjajax.js
See also Coldtags suite - the largest collection of custom JSP tags.
Related links: