You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2010/09/10 06:47:50 UTC

[jira] Updated: (WICKET-2206) OnLoadAjaxBehavior

     [ https://issues.apache.org/jira/browse/WICKET-2206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2206:
----------------------------------

    Fix Version/s: 1.5-M3
                       (was: 1.5-M2)

> 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
>             Fix For: 1.5-M3
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.