开发者

Wicket 1.5 call wicket from javascript

I开发者_开发问答'm developing a project under Wicket 1.5 which uses jQuery.

I've been using Wicket 1.4 before, and I'm used to call Wicket Java code from JavaScript with

function callWicket() {
   var wcall = wicketAjaxGet('$url$' + '$args$', function() { }, function() { });
}

As seen in Calling Wicket from Javascript. It works fine under Wicket 1.4.

But when I do this on Wicket 1.5, I receive this response,

<ajax-response>
  <redirect>?0</redirect>
</ajax-response>

which redirects to the page and destroys the Ajax flow..

(I've seen Javascript in Wicket 1.5, but my question is the other side of the behaviour...)

I'm using this to control hashtag (#tag) history in browers, in conjunction with jQuery and jQuery history. Alternatively, is there another method to control hashtag with Wicket 1.5 ?

thanks!!


The same code should work in 1.5. It seems you do something in your onAjaxCallback() that makes Wicket do the redirect, e.g. something like setResponsePage(AnotherPage.class). To manage the hash tag you can use target.appendJavaScript("localtion.hash='#anything'"). With JQuery History you can listen to hashchange event (and since recently to popchange event) and depending on the hash value do Wicket Ajax calls with different URL and/or parameters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜