Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wicket link - is adding a label necessary to set the text?

Currently, I do this:

<li><a wicket:id="link" href="#"><span wicket:id="name">jawa01</span></a></li>

and

item.add( new BookmarkablePageLink("link", ResourcePage.class)
   .setParameter("name", item.getModelObject().getName())
   .add( new Label("name", item.getModelObject().getName()) )
);

I want to do ommit the element:

<li><a wicket:id="link" href="#">...</a></li>

How should the java code look?

I expect something like

item.add( new BookmarkablePageLinkWithLabel(
   "link", ResourcePage.class, item.getModelObject().getName())
   .setParameter("name", item.getModelObject().getName())
);

Thanks, Ondra

like image 608
Ondra Žižka Avatar asked May 12 '10 06:05

Ondra Žižka


1 Answers

This is not built into Wicket, with a couple of reasons presented here.

However, you can certainly make you own component out of what you currently do to make your life easier. The constructor would take both the model for the link and the model for the label.

like image 79
schmimd04 Avatar answered Sep 30 '22 12:09

schmimd04