• Post Reply Bookmark Topic Watch Topic
  • New Topic

JQuery librray is not working in jSP file

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there
I am using Spring to develop a web application
I have used JQuery ui in HTML page it is working fine a Dialog box appear with JQuery effect.But When I use the same procedure in jsp it is not working.

Here is my code of jsp file



this is my project structure

and I am getting this is browser


Where is error?

Rest Spring is Working fine


Thanks
output.PNG
[Thumbnail for output.PNG]
structure.PNG
[Thumbnail for structure.PNG]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your URL starting with /js/ is almost certainly incorrect, and even if it's not, it's fragile. The resource URLs should begin with the context path. See the JspFaq for details.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply

I found solution by adding this line on top of code.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

By adding all JQuery basic effects are working fine.But I have not tested JQueryUI effects in it

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that loads jQuery from a CDN rather than from your server.

But you ought to learn why it didn't work earlier because you will run into the same type of problem with other resources loaded from your server rather than a CDN.
 
Arun Peter
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this out. You will need jstl libraries in classpath.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Peter wrote:Try this out. You will need jstl libraries in classpath.

Yes, <c:url> can be used to resolve a URL with the context path, but I wouldn't use it to form a prefix rather than an entire URL. If a prefix is desired, it can be more simply achieved with an EL expression.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!