Accessing javascript (Jquery) variables from Apache Wicket

淺唱寂寞╮ 提交于 2019-12-25 04:20:00

问题


I'm a noob learning Wicket/Jquery. I'm trying to access JavaScript (Jquery) variables from Wicket. Here's an example I'm working 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!!!


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/5139715/accessing-javascript-jquery-variables-from-apache-wicket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!