To start using the Tags Library, you'll need the following:
The library download can be done in two different ways:
It' is also necessary downloading the JavaScript files:
Note: In order to get a better performance and loading JavaScript files faster, it is recommended compressing such files (for example with this tool).
If you compress jstags files and include them in only one file as well, remember you can not use the enable tag but load that file yourself with a script tag instead.
Although most of times you will include all the tld's in your project pages header, depending on the features you request from jstags, you may prefer including only those you need.
<!-- Include this to use any of the general tags (enable). The inclusion of this tld is recommended --> <%@ taglib uri="http://jstags.sourceforge.net/tld/jstags.tld" prefix="jstags"> <!-- Include this to use any of the content (Ajax) tags --> <%@ taglib uri="http://jstags.sourceforge.net/tld/jstags-ajax.tld" prefix="ajax"> <!-- Use this to use any of the effects tags --> <%@ taglib uri="http://jstags.sourceforge.net/tld/jstags-effects.tld" prefix="effects"> <!-- Use this to include any of the forms tags --> <%@ taglib uri="http://jstags.sourceforge.net/tld/jstags-forms.tld" prefix="forms">
MochiKit library has to be included as well.
<script type="text/javascript" src="js/mochikit/MochiKit.js" />
JSTags needs its own JavaScript code in order to work properly. This files can be included in two different ways:
<!-- Include this one always --> <script type="text/javascript" src="js/jstags/jstags.js" /> <!-- Not necessary if only using effects. Otherwise, include it --> <script type="text/javascript" src="js/jstags/jstags-utils.js" /> <!-- Only neccessary if you include tags from the jstags-forms.tld --> <script type="text/javascript" src="js/jstags/jstags-forms.js" /> <!-- Only neccessary if you are to include tags from the jstags-content.tld --> <script type="text/javascript" src="js/jstags/jstags-content.js" /> <!-- Only neccessary if you are to include tags from the jstags-effects.tld --> <script type="text/javascript" src="js/jstags/jstags-effects.js" />
<jstags:enable jstagsFolder="${yourJstagsFolder}" effects="true" forms="false" content="true" />
Now, the library has been correctly installed and you can start using it.
Some of the tags attributes need either a JavaScript-like Array or Object. That is, a String in the form [...] or {...}. These attribute values can be built not only by hand but also by means of third party libraries which, depending on the case, may be easier. The third party libraries that may help you are: