[
https://issues.apache.org/jira/browse/WICKET-2206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin Grigorov resolved WICKET-2206.
-------------------------------------
Resolution: Won't Fix
This is now possible with:
class MyPage extends WebPage {
@Override
public void renderHead(IHeaderResponse response) {
response.renderOnLoadJavaScript(....)
}
}
> OnLoadAjaxBehavior
> ------------------
>
> Key: WICKET-2206
> URL: https://issues.apache.org/jira/browse/WICKET-2206
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Affects Versions: 1.4-RC2
> Reporter: Juha Paananen
>
> It would be convenient to have an OnLoadAjaxBehavior that can be used to
> execute server side code when page is loaded. For instance, I'm using this to
> check if the page has expired (the related user workflow has already
> finished). In short, here's the code:
> public abstract class OnLoadAjaxBehavior extends AbstractDefaultAjaxBehavior {
> private static final long serialVersionUID = 1L;
> @Override
> public void renderHead(final IHeaderResponse response) {
> StringBuilder javascript = new StringBuilder();
> javascript.append("wicketAjaxGet('" + getCallbackUrl() + "',
> function() {}, function() { });\n");
> response.renderOnLoadJavascript(javascript.toString());
> }
> }
> This leaves the respond(..) method abstract. The concrete classes will add
> the server behavior in their implementations of the respond(..) method.
> For me it took several hours to find out how to do this relatively simple
> thing. If we had this behavior class in Wicket, it would save some time for
> other n00bs.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira