【发布时间】:2016-06-15 03:33:30
【问题描述】:
WebContent> META-Inf>resources>theme1>css> main.css 文件
您能帮我找出为什么我无法在我的 Web 应用程序中使用外部 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" />
春季调度服务小程序
<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>
【问题讨论】:
-
您是否看到任何错误?
标签: javascript jquery css spring