Home Tutorial Spring Spring3 Web Spring MVC JQuery Integration

 
 

Share on Google+Share on Google+
Spring MVC JQuery Integration
Posted on: June 1, 2012 at 12:00 AM
Advertisement
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.

Advertisement

Related Tags for Spring MVC JQuery Integration:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 1, 2012

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com