Spring MVC JQuery Integration


 

Spring MVC JQuery Integration

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

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.

Ads