auron wrote:
Sorry to be the wicket newbie, but I was wondering if you guys could help me
to understand how Links work.
I understand that when you do Link(SomePage.class), it calls the zero param
constructor of SomePage, and when you do Link(new SomePage(someParams)) you
can call other constructors, but besides this, what are the other
differences?

I assume you're talking about PageLink not Link?

new PageLink(id, SomePage.class) will generate a URL which will construct a new page when you click on it.

new PageLink(id, new SomePage()) obviously creates a SomePage instance right then and there. The page instance is stored in the session and dug out if the user clicks on the link.

You should obviously try to create links which create new pages when you click on them, not when you construct the link (i.e. the former). For this reason, in Wicket 1.3 we've deprecated the second form as this seemed to confuse people. Instead, use a normal Link and call setResponsePage() in the onClick(). At least, then it'll be obvious what you're doing and encourage people to only construct their new pages within a click handler, rather than within the constructor for the original page.

Regards,

Al

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to