How to use jQuery in a GWT application?

I am new to GWT.i created one simple registration form using GWT.i I want to add confirmation for each field using jquery.please, help me explain how I can use jquery in GWT.

thanks

+4
source share
3 answers

You would be better off using gwtQuery , which is the jQuery port (not shell) for GWT.

Better because it is Java, so you can use it directly without typing tons of wrappers and because the GWT will only compile the parts (functions) that will actually be used, which will result in a significantly smaller code.

+7
source

No need to use an external library like jquery. What is jquery suitable for?

  • Element selection: You do not need to select elements for you to create them yourself, and you can store them in variables for later use. This is more efficient than moving the DOM later to get the element you are looking for.
  • Animation: gwt has an animation class that you can easily use to animate the properties of CSS elements.
  • Creating new elements: This can also be done using GWT.
  • Events:. Can be done with GWT, plus you have a global eventbus and no need to abuse the window object like eventbus. Event delegation can also be done using GWT; see the source code of CellList to understand how to work with it in GWT.

Working with GWT for six months on a really big project, I did not see the need to use external libraries, such as jquery. The only thing we missed is drag'n drop, we use gwt-dnd for this.

+7
source

You can access the built-in GWT functions using jQuery, or you can use gwtQuery

-1
source

All Articles