Populating ExternalLink from Model in Wicket
I am sure I am overlooking something very basic here, but I just don't get how to create an ExternalLink inside a WebMarkupContainer from the model of the WebMarkupContainer.
container = new WebMarkupContainer("view");
container.setOutputMarkupId(true);
container.setDefaultModel(new CompoundPropertyModel<Article>(new Article()));
container.add(new Label("title"));
container.add(new MultiLineLabel("article")); 开发者_Go百科
container.add(new ExternalLink("originalUrl",???)));
I'd appreciate hints how to create this url. I am sure there must be a way to obtain a reference to the model of the container, I just don't get it :( Why doesn't it just work the same way as Label?
Can't check it right now but if you're using a CompoundPropertyModel on your container, container.add(new ExternalLink("originalUrl")));
should work. If not, try using container.add(new ExternalLink("originalUrl", model.bind("originalUrl")));
.
精彩评论