web.xml
<servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> mvc-dispatcher-servlet.xml
<context:component-scan base-package="com.mastercomputer" /> <context:property-placeholder location="classpath:application.properties" /> <mvc:annotation-driven /> <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:resources mapping="/resources/**" location="/resources/css" /> <mvc:resources mapping="/resources/**" location="/resources/images" cache-period="10000"/> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/pages/" /> <property name="suffix" value=".jsp" /> </bean> Jsp
<section class="content"> <h2>Лучшие предложения</h2> <c:forEach var="note" items="${list}" > <div class="bestDeals"> <img src="<c:url value="/resources/images/Acer ES1-531.jpeg"/>" alt="Foto NoteBook" style="width: 150px;height:150px"/> <p>${note.name}</p> <p>${note.price}</p> <input type="submit" value="Купить" /> </div> </c:forEach> </section> Help me figure out where the error is.
mvc:resources. Judging by the URL, you only need the first option:<mvc:resources mapping="/resources/**" location="/resources/" />. Ps .Acer ES1-531.jpeggood programmers do not use spaces. :) - enzo