In order to use the TreeListControl-tag on a JSP page, the corresponding tag library must
be declared at the start of the page. Then, the Common-Controls can be referenced with
the prefix <ctrl:tagname />. [In addition, the tag libraries
must be included in the Deployment descriptor, the WEB-INF/web.xml file]
<%@ taglib uri="/WEB-INF/tlds/cc-controls.tld" prefix="ctrl" %>
<ctrl:treelist
id="tl1"
name="regions"
action="sample301/regionBrowse"
title="Regions Structure"
rows="15"
refreshButton="true"
expandMode="multiple"
root="true">
<ctrl:columntree
title="Region"
property="region"
width="180"
imageProperty="type"/>
<ctrl:columntext
title="Name"
property="name"
width="250"/>
<ctrl:columnadd
title="Add"
property="add"/>
<ctrl:columnedit
title="Edit"
property="editable"/>
<ctrl:columndelete
title="Delete"
property="editable"/>
</ctrl:treelist>
Since we have saved the TreeListControl in the session, the name of the Bean is specified via the Name attribute. In addition, with the action attribute, that action is specified to which actions from our TreeListControl (onEdit, onDelete, etc... ) are delegated.
If the TreeListControl is saved in a FormBean, it is enough to specify the property attribute. In this case, the scope of the Formbean must be set to "session", so that the control element can retain its state across server roundtrips.
When using a workflow control, the control element can be generated with other components and later deleted from the session.
All the necessary steps for using the TreeListControls are thus commplete. The opening and closing behavior does not have to be self-implemented. It is administered by the control element itself. For navigation, the control element provides scrolling buttons which are enabled as soon as the specified number of lines is exceeded.
back |
continue
|