Home Tutorial Spring Spring3 Web Spring MVC JQuery Integration

 
 

Spring MVC JQuery Integration
Posted on: June 1, 2012 at 12:00 AM
In this section, you will learn about Spring MVC JQuery Integration by deployment descriptor.

Spring MVC JQuery Integration

In this section, you will learn about Spring MVC JQuery Integration by deployment descriptor.

PROBLEM

When you are including your js file in your view JSP file or adding any jQuery plug in using relative path, it doesn't include it. If you views the source code of that page and click on it, it will show you resource not found type error because it didn't locate the .js file

SOLUTION

You can eliminate the above problem by adding .js URL pattern mapping in deployment descriptor(web.xml) as follows :

<servlet>
<servlet-name>statCont</servlet-name>

<servlet-class>
	org.apache.catalina.servlets.DefaultServlet
</servlet-class>
<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>
<servlet-name>statCont</servlet-name>

<url-pattern>*.js</url-pattern>
</servlet-mapping>

<servlet-name> can be any name you want.

Related Tags for Spring MVC JQuery Integration:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.