Java spring mvc中未显示图像
我试图在spring mvc应用程序中的index.jsp上显示图像,但无法找到我添加的图像的实际路径mvc:resources标记的正确路径,但无法显示静态图像。这是我的密码 spring-servlet.xmlJava spring mvc中未显示图像,java,jsp,spring-mvc,Java,Jsp,Spring Mvc,我试图在spring mvc应用程序中的index.jsp上显示图像,但无法找到我添加的图像的实际路径mvc:resources标记的正确路径,但无法显示静态图像。这是我的密码 spring-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/X
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="in.net.usit"/>
<tx:annotation-driven transaction-manager="transactionManager"/>
<mvc:annotation-driven></mvc:annotation-driven>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/lts2d/lts2dnew"></property>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="packagesToScan" value="in.net.usit.beans"></property>
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect" >org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql"> true</prop>
<prop key="hibernate.hb2ddl.auto">update</prop>
<prop key="hibernate.connection.pool_size">1</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<mvc:resources mapping="/resources/**" location="/resources/img/"/>
<!-- <mvc:default-servlet-handler /> -->
org.hibernate.dialogue.mysqldialogue
真的
更新
1.
var module=angular.module('myApp',[]);
模块控制器('myController',函数($scope){
log('在索引页内');
});
在此处插入标题
如果您有/webapp/resources/ImgPitSide.png
因此,您可以这样访问:
<mvc:resources mapping="/resources/**" location="/resources/"/>
<img src="<c:url value='/resources/ImgPitSide.png'/>"/>
"/>
像这样尝试“/>@GurkanYesilyurt相同的结果使用self-closing tag@GurkanYesilyurt相同的结果同样图像的链接i显示正确的路径,但不加载图像控制台上没有错误?