Properties File

uitags comes bundled with a set of default configuration values, called "factory default" settings. You can override these values, and therefore alter uitags' default behavior, by placing uitags.properties in your WEB-INF/classes directory.

        WEB-INF/
           |
           +--- classes/
                   |
                   +--- uitags.properties
      

Use the factory-default properties file as a template for your uitags.properties file.

Another way to control uitags' behavior is by setting values through tag attributes. Some tag attributes have a corresponding entry in uitags.properties. If you expect certain configuration values to be used consistently throughout the whole webapp, put them in the uitags.properties file rather than specify them each time you use a tag.

JavaScript

You need to include uitags JavaScript wherever you use its custom tags. uitags provides a servlet that serves JavaScript to the client browser.

To configure the servlet place the following in web.xml:

        <servlet>
          <servlet-name>uitags.js</servlet-name>
          <servlet-class>net.sf.uitags.js.JsProviderServlet</servlet-class>
        </servlet>

        <servlet-mapping>
          <servlet-name>uitags.js</servlet-name>
          <url-pattern>/uitags.js</url-pattern>
        </servlet-mapping>
      

And in your JSP include the following:

        <script type="text/javascript" src="<my-context>/uitags.js"></script>
      

Internationalization (I18N)

Webapps usually rely on frameworks/tools such as Struts or JSTL for internationalization. You can configure uitags plug into your internationalization framework.

By the default uitags ignores i18n, it displays strings (provided by tag attributes or in properties files) as is. To enable i18n, simply nominate the adapter that understands how to interface with your i18n framework. For example, the following line in site-wide.properties tells uitags to use Struts i18n framework:

          common.message.finder=net.sf.uitags.tagutil.StrutsMessageFinder
        

You can provide your own message finder, it just has to implement the net.sf.uitags.MessageFinder interface. Note: at the moment Struts and JSTL message finders are the only adapters provided by uitags. We'd appreciate help in writing adapters for other frameworks such as Spring, WebWork, etc.

After enabling i18n, you should ensure that you always pass message keys to uitags rather than the actual strings to be displayed.