jyriand
jyriand

Reputation: 2524

Path to JQuery library in <script> tag using Spring MVC

I downloaded jquery library and added it to WebContent/js folder in Spring MVC project. In my jsp file i have a line but when i try to use jquery functions, it doesnt work. When i replace source path to "http://code.jquery.com/jquery-latest.js" it works fine. Jsp files are located in "WebContent/WEB-INF/jsp" folder. What is the correct path to jquery library?

Upvotes: 1

Views: 1168

Answers (1)

driangle
driangle

Reputation: 11779

Check out this answer. Basically you need to use the <c:url /> tag to generate the correct relative path to your script.

In your case, you'll want to use:

<script src="<c:url value='/js/jquery.js' />"></script>

Upvotes: 3

Related Questions