开发者

Accessing javascript (Jquery) variables from Apache Wicket

开发者 https://www.devze.com 2023-02-14 07:57 出处:网络
I\'m a noob learning Wicket/Jquery. I\'m trying to access JavaScript (Jquery) variables from Wicket. Here\'s an example I\'m workin开发者_如何学Gog with:

I'm a noob learning Wicket/Jquery. I'm trying to access JavaScript (Jquery) variables from Wicket. Here's an example I'm workin开发者_如何学Gog with:

        Component slider = new WebMarkupContainer("slider").add(new SliderBehavior(
            new SliderOptions().changeEvent("alert('clicked!')").orientation(Orientation.HORIZONTAL).min(10).max(100).value(20)));

I'm implementing here a jqwicket slider example. Instead of the "alert('clicked!')" event I would like to read the value of the slider to the java. All help appreciated!!!


you have to combine jquery's "changeEvent" with the ajax request sending current slider value to your wicket component.

jqwicket contains example for doing this. for more information see AjaxSlider here:

http://code.google.com/p/jqwicket/source/browse/tags/jqwicket-demo-0.4/jqwicket-demo/src/main/java/net/javaforge/jqwicket/SliderPage.java


https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/jquery-parent/jquery-examples/src/main/java/org/wicketstuff/jquery/demo/ui/Page4Slider.java

0

精彩评论

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