的WebContent> META-INF>资源> THEME1> CSS> main.css文件
您能否帮我找一下为什么我无法在我的网络应用程序中使用外部css文件。
我在webContent中创建了一个main.css文件,如上所示。我已经坚持了这个问题一个星期。
enter code here
**jsp**
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
<spring:url value="/resources/theme1/css/main.css" var="main" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link href="${main}" rel="stylesheet" />
spring dispatcher servelet
<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-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:component-scan base-package="com.mkyong.common.controller" />
<mvc:annotation-driven />
<context:component-scan base-package="com.tripapplication.LoginController."></context:component-scan>
<context:component-scan base-package="com.tripapplication.RegisterController."></context:component-scan>
<!-- <context:component-scan base-package="com.tripapplication.TripInfoFirstController."></context:component-scan> -->
<!-- <context:component-scan base-package="com.tripapplication.TripInfoSecondController."></context:component-scan> -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="prefix">
<value>/WEB-INF/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<mvc:resources mapping="/resources/**" location="/resources/theme1/css"
cache-period="31556926"/>
<mvc:annotation-driven />
</beans>
答案 0 :(得分:0)