У меня есть 3 jsps, которые должны отображать изображение для пива, представленного на столах, для Allbeers. jsp показывает это нормально, но Viewbeer. jsp и Searchbeers. jsp dowsnt отображает их вообще, но показывает все остальные информация об объекте.
Конфиг. xml is
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package="brewery.src.controller" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/views</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" >
<property name="validationMessageSource" ref="messageSource"/>
</bean>
<bean id="messageAccessor" class="org.springframework.context.support.MessageSourceAccessor">
<constructor-arg index="0" ref="messageSource"/>
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="en_IE" />
</bean>
<mvc:interceptors>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language" />
</bean>
</mvc:interceptors>
<mvc:resources mapping="/Image/**" location="/Image/"></mvc:resources>
Allbeers. jsp, который показывает изображение
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<form action="/Assignment3/beer/search">
<input type="text" name="searchTerm">
<input type="submit" value="<spring:message code="label.search"/>">
</form>
<form action="/Assignment3/beer/chooseLocale">
<select name="locale">
<option value="en"><spring:message code="lang.english"/></option>
<option value="es"><spring:message code="lang.spanish"/></option>
</select>
<input type="submit" value="<spring:message code="button.chooseLocale"/>"/>
</form>
</head>
<table style="width:100%">
<thead>
<tr>
<th align="left">ID</th>
<th align="left">Name</th>
<th align="left">ABV</th>
<th align="left">Image</th>
<th align="left">Action</th>
</tr>
</thead>
<tbody>
<c:forEach items="${beerList}" var="beer">
<tr>
<td>${beer.id}</td>
<td>${beer.name}</td>
<td>${beer.abv}</td>
<td><img src="Image/${beer.image}" width="50" height="50"></td>
<td>
<form action="/Assignment3/beer/viewBeer">
<input type="hidden" name="id" value="${beer.id}"/>
<input type="submit" value="<spring:message code="label.viewDetails"/>"/>
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</html>
Searchbeers. jsp, который не показывает изображение,
<table style="width:100%">
<thead>
<tr>
<th align="left">ID</th>
<th align="left">Name</th>
<th align="left">ABV</th>
<th align="left">Image</th>
<th align="left">Action</th>
</tr>
</thead>
<tbody>
<c:forEach items="${beerList}" var="beer">
<tr>
<td>${beer.id}</td>
<td>${beer.name}</td>
<td>${beer.abv}</td>
<td><img src="Image/${beer.image}" width="50" height="50"></td>
<td>
<form action="/Assignment3/beer/viewBeer">
<input type="hidden" name="id" value="${beer.id}"/>
<input type="submit" value="<spring:message code="label.viewDetails"/>"/>
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
Viewbeer. jsp, который не показывает изображение,
<table cellspacing="10">
<tr>
<td><spring:message code="label.id"/></td>
<td>${beer.id}</td>
</tr>
<tr>
<td><spring:message code="label.name"/></td>
<td>${beer.name}</td>
</tr>
<tr>
<td><spring:message code="label.abv"/></td>
<td>${beer.abv}
</tr>
<tr>
<td><spring:message code="label.lastMod"/></td>
<td>${beer.lastMod}</td>
</tr>
<tr>
<td><spring:message code="label.description"/></td>
<td>${beer.description}</td>
</tr>
<tr>
<td><spring:message code="label.category"/></td>
<td>${beer.catName}</td>
</tr>
<tr>
<td><spring:message code="label.style"/></td>
<td>${beer.styleName}</td>
</tr>
<tr>
<td><img src="Image/${beer.image}" width="50" height="50"></td>
</tr>
</table>