Hi, You can use Border component. It will provide the <div>s: <wicket:border> <div>...</div> <wicket:body/> <div>...</div> </wicket:border> In #populateItem(): Link link = ... MyBorder border = new MyBorder("contentLink"); border.add(link); listItem.add(border);
Or you can use a Behavior that will use Component#getResponse().write("<div> ...</div>") in its #beforeRender() and #afterRender(). Link link = new Link("contentLink") {...}; link.add(new MyBehavior()); listItem.add(link); On Mon, Jun 11, 2018 at 11:08 AM, Martin Nielsen <mny...@gmail.com> wrote: > Hello Wicket users > > I am trying to figure out how to create a subclass of ListView, which adds > a couple of <div> elements around the contents of the ListItem. The caveat > is that the <div> elements should not be defined in the html Markup. > > For example: > > ----------------------------------------------------- > html > <ul> > <li wicket:id="listRow"> > <a wicket:id="contentLink" href="#" ></a> > </li> > </ul> > > java > > new MyListView("ListRow", someModel) { > @Override > protected void populateItem(ListItem item) { > item.add(new AjaxLink("contentLink"){ > //do stuff > }); > } > } > > > ----------------------------------------------------- > > should yield: > <ul> > <li> > <div></div> > <a href="#" ></a> > <div></div> > </li> > <li> > <div></div> > <a href="#" ></a> > <div></div> > </li> > <li> > <div></div> > <a href="#" ></a> > <div></div> > </li> > ... > </ul> > > ----------------------------------------------------- > > > If the div's can somehow become components on the java-side, that would be > awesome, but it is not entirely required. > > Thanks for your help (in advance) > > -Martin >