Spring MVC 3 and handling static content
We can handle static content for example: js,css,images in Spring MVC by using mvc:resources element. mvc:resources element is used to point to the location of static content with a specific public URL pattern.
For example – define the below line in your application-servlet.xml file. This line will serve all requests for static content coming in with a public URL pattern like “/assets/**” by searching in the “/assets/” directory under the root folder in our application.:
<mvc:resources mapping="/assets/**" location="/assets/" />
Here you can find the complete example:
LoginController.java:
package com.evon;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
To Read more about Spring MVC 3 and handling static content visit FindNerd.
FindNerd also facilitate its users to ask questions section in which one can post his programming queries on android, php, java, c programming questions and answers etc. Also, we assure to reach you as soon as possible we see it.
Advertise on APSense
This advertising space is available.
Post Your Ad Here
Post Your Ad Here
Comments