You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com> on 2010/09/30 15:56:28 UTC
Understanding wicket lifecycle and model past to wicket
components
I have two scenarios, a and b. In one case I use the loadable
detachable model and the other I don't. Is it possible when the wicket
component in scenario b is deserialized, is it possible that the object
won't be available?
(a) Page Constructor code with Loadable detachable model:
MyPage.java:
...
final Form<AppBean> form = new Form<AppBean>(FORM, new
CompoundPropertyModel<AppBean>(new LoadableDetachableModel<AppBean>() {
@Override
protected AppBean load() {
final AppBean AppApplication = (AppBean)
WicketSession.get().getApp();
return AppApplication;
}
};
});
-------
(b) Page Constructor without Loadable detachable model:
MyPage.java
...
LINE2: final Form<AppBean> form = new Form<AppBean>(FORM, new
CompoundPropertyModel<AppBean>((AppBean) WicketSession.get().getApp())
<--- offending call
-------
SomeOtherPage.java:
public SomeOtherPage() {
new Link() {
onClick() {
setResponsePage(MyPage.class); <---- Use wicket deserialization
to get MyPage.class, constructor not called.
}
}
}
LINE2: (AppBean) WicketSession.get().getApp()
QUESTION: in scenario (B), is it possible that the call to create the
Form will be null? if I don't use the loadable detachable model?
Because the constructor was not called to render that page again.
Berlin Brown