Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Excerpt Include
ajax common header


Wiki Markup

Quick Example

This example describes basic usage of the <s:tree.../> tag showing both the model behind the tree and the JSP fragment that uses it. This section of the documentation is a work-in-progress; more to follow.

Code Block
titleBacking Model

 * In this example it is assumed that the backing POJO is a tree-like structure
 * consisting of same-type elements, roughly like the following, with getters
 * and setters not shown for clarity.
 * This could be, say, a Hibernate/etc. POJO stored in a database and loaded lazily, etc.
 * TODO Determine allowable collection types; I know for a fact Set works.
public class TreeModel {
    private Long _id;                 // Node's ID.
    private String _name;             // Node's name property.
    private Set<TreeModel> _children; // Node's children.
Code Block

 * Fragment of Action class showing the minimum necessary to support the
 * following JSP code. Getters, setters, functionality not shown.
public class ShowTreeAction {
    private TreeModel _rootNode;      // Top-level tree node.


  - @attrib rootNode 
  -             OGNL value holding top-level tree node.
  - @attrib childCollectionProperty 
  -             Property of rootNode containing child nodes.
  - @attrib nodeIdProperty
  -             Property of each node containing "value" of node, like an ID.
  - @attrib nodeTitleProperty
  -             Property of each node containing tree label text.
<s:tree theme="ajax"




Wiki Markup


Static tree:

Wiki Markup

Dynamic tree (rendered on the server):

Wiki Markup



Dynamic tree loaded with AJAX (one request is made for each node):

Wiki Markup