views:

157

answers:

3

I have been able to use Jquery with ASP.NET because I know where to drop the JQuery Library, but I am trying to integrate JQuery with Java Web Applications using JSP's,Servlets, etc.

It seems like a trivial question, but for some reason I am unable to figure out where to drop the JQuery Javascript file.

+3  A: 

Put it under your web structure. (i.e.)

webroot/static/scripts/jquery/jquery.js

So you can acces from: http://host:port/webroot/static/scripts/jquery/jsquery.js

The web structure is kindly arbitrary (expect for the WEB-INF directory). All the resource are public under the root, expect (again) the resources under WEB-INF.

I hope it helps you.

Aito
+2  A: 

If you have access to modify headers of html files you can load the jQuery library with Google CDN for Ajax Libraries without having to drop it physically on your server anywhere.

Elzo Valugi
A: 

If you use RichFaces, jQuery support is pretty-much built-in. You can use jQuery on your page after doing this, in the head section:

<a4j:loadScript src="resource://jquery.js"/>

Then you can use jQuery by calling "jQuery('selector goes here')". Richfaces uses '$' for it's own purposes, so calling "$('selector goes here')" won't work.

Jon