[英]how to add external css file in spring web aplication
WebContent> META-Inf>资源> 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.