Aadam
Aadam

Reputation: 1541

Can I use jquery.js directly in Struts 2?

I already have a simple application, to experiment I am implementing the same in Struts 2. In an old app I've used jQuery, now can I use directly the same jquery.js here or shall I opt for Struts 2 jQuery Plugin?

I tried with jquery.js, I am getting null pointer exception. So I am confused now. Some one tell the difference between two. Both are jQuery only wright?

Upvotes: 0

Views: 737

Answers (2)

Roman C
Roman C

Reputation: 1

If you have got NullPointerException, it doesn't mean that JQuery or plugin has bugs. You are getting errors because you are doing something wrong in the code, misunderstanding or something.

Struts 2 JQuery is a tag library that you can use with Struts 2 framework. It contains the JQuery inside it. JQuery is only a JavaScript library. Using the plugin you have Ajax support with Struts 2 framework.

Upvotes: 1

Quincy
Quincy

Reputation: 4433

Try setting loadAtOnce in <sj:header> tag to true to disable on demand script loading. So the jQuery script will be loaded at page load. You should be able to use your own library scripts without manually loading your own copy of jquery.js.

Ref. Here

Upvotes: 3

Related Questions