I added a simple page containing single image which is in '/resources/images/' folder but when run on server, images don't load on the page. Followed many blogs but unable to resolve this problem. The controller mapping is as follows:
@RequestMapping(value = "/image", method = RequestMethod.GET)
public ModelAndView imagepage() {
ModelAndView img = new ModelAndView("image_check");
return img;
}
image_check.jsp file is as follows:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<img src="/resources/ABC_bank.png" alt="Smiley face" height="42" width="42">
</html>
project-servlet.xml is as follows:
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="/resources/images/" />
images are present in '/webapp/resources/images/' folder. The page opens but the images don't load.