I’m using jsTree jQuery plugin for drawing a tree.
When user clicks a node, an ajax request containing node’s id is send to server.
In my response I generating such piece of html (this is done in separate servlet):
<li id="node_id_1"><a href="foobar">Child item 1</a></li>
<li id="node_id_2"><a href="foobar">Child item 2</a></li>
<li id="node_id_3"><a href="foobar">Child item 3</a></li>
<li id="node_id_4"><a href="foobar">Child item 4</a></li>
<li id="node_id_5"><a href="foobar">Child item 5</a></li>
And this items are drawn under the selected node.
The question is: what value should I use for href attribute for referring wicket pages? I.e. I need links pointing to class MainPage with some parameters.
What you want is a RepeatingView or ListView that returns some BookmarkablePageLink objects:
Here is a Sample component:
And the corresponding HTML:
I’ve used a
MyDomainObjecttype that just has an id and a name. The name is displayed, the id is linked to. Basically you can add any serializeable parameter to aBookmarkablePageLinkand then parse the parameter from the page you link to using the Page.getPageParameters() method.