开发者

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

开发者 https://www.devze.com 2022-12-30 04:05 出处:网络
Currently, I do this: <li><a wicket:id=\"link\" href=\"#\"><span wicket:id=\"name\">jawa01</span></a></li>

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 expec开发者_JAVA百科t something like

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

Thanks, Ondra


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号