TheJediCowboy
TheJediCowboy

Reputation: 9222

JQuery Integration with JavaEE

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.

Upvotes: 2

Views: 2558

Answers (4)

peter_pilgrim
peter_pilgrim

Reputation: 1160

In modern Digital web platforms, put jquery.js in a folder /javascripts following the Twitter Bootstrap convention.

If you are using JSF 2.x then under folder /resources/javascripts

Upvotes: 0

Jon Onstott
Jon Onstott

Reputation: 13727

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.

Upvotes: 0

Aito
Aito

Reputation: 6872

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.

Upvotes: 3

Elzo Valugi
Elzo Valugi

Reputation: 27866

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.

Upvotes: 2

Related Questions