I've posted this as a reply to another thread but I think it deserves a thread of its own. What happens is that I'd like to show and hide a label by setting switch between setVisible(true) and setVisible(false) when clicking on a AjaxFallbackLink. I've wrapped the label inside a WebMarkupContainer to make this doable. Here is the code:
public BasePage() { final WebMarkupContainer table = new WebMarkupContainer(this, "tableId"); table.setOutputMarkupId(true); final Label label = new Label(table, "labelId", "This is a label"); label.setOutputMarkupId(true); label.setVisible(false); new AjaxFallbackLink(this, "linkId") { private static final long serialVersionUID = 5523627214368899839L; @Override public void onClick(AjaxRequestTarget target) { final boolean visible = label.isVisible(); label.setVisible(!visible); target.addComponent(table); } }; } When I click on the AjaxFallbackLink the first time everything is fine, the label (with wicket id "labelId") gets visible. But when I click the link again to make it invisible, I get a NullPointerException when executing label.setVisible(..). Debugging down into the wicket source code tells me that the NullPointerException occurs on 327 in class Page, when it tries to execute "versionManager.componentStateChanging(change)". However versionManager is null. Why is this? Is this a bug or am I doing something wrong? Thanks -- View this message in context: http://www.nabble.com/Could-this-be-a-bug-in-Wicket-2--tf3268456.html#a9086303 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user