0
내 CSS 파일이 아니라는 것을 제외하면 내 응용 프로그램이 작동합니다. 나는 봄 MVC와 테마를 사용하고있다. 아마도 누군가 내 코드를보고 내가 잘못하고있는 것을 볼 수 있습니다. 내 프로젝트 디렉토리의 스크린 샷도 포함 시켰습니다. 내 응용 프로그램의 페이지 소스를 볼 때 링크 rel 태그의 "href"링크 끝에 jSessionId가 추가됩니다. 그게 효과가 있니?스프링 MVC 테마 지정, CSS 적용 안 함
서블릿의 context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>
<default-servlet-handler/>
<!-- Tiles Configuration -->
<beans:bean class="org.springframework.web.servlet.view.UrlBasedViewResolver" id="tilesViewResolver">
<beans:property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
</beans:bean>
<beans:bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" id="tilesConfigurer">
<beans:property name="definitions">
<beans:list>
<beans:value>/WEB-INF/layouts/tiles.xml</beans:value>
</beans:list>
</beans:property>
</beans:bean>
<interceptors>
<beans:bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor"/>
<beans:bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="lang"/>
</interceptors>
<beans:bean class="org.springframework.context.support.ReloadableResourceBundleMessageSource" id="messageSource" p:basenames="WEB-INF/i18n/messages,WEB-INF/i18n/application" p:fallbackToSystemLocale="false"/>
<beans:bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="locale"/>
<context:component-scan base-package="com.jamesanthony527.herdmanager.controller" />
<beans:bean class="org.springframework.ui.context.support.ResourceBundleThemeSource" id="themeSource"/>
<beans:bean class="org.springframework.web.servlet.theme.CookieThemeResolver" id="themeResolver" p:cookieName="theme" p:defaultThemeName="standard"/>
</beans:beans>
template.jsp
<!DOCTYPE HTML>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<spring:message code="welcome_titlebar" var="TitleBar"/>
<html>
<head>
<!-- <meta charset="utf-8"> -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="<spring:theme code="styleSheet" />" />
<title>${TitleBar}</title>
</head>
<body>
<div id="wrapper">
<div id="header"><tiles:insertAttribute name="header"/></div>
<div id="body"><tiles:insertAttribute name="body"/></div>
<div id="footer"><tiles:insertAttribute name="footer"/></div>
</div> <!-- end wrapper -->
</body>
</html>
standard.css
#wrapper {
height:800px;
width:600px;
background-color: #00FFFF;
}
#head {
height:100px;
width:100px;
}
standard.properties
styleSheet=/resources/styles/standard.css
,745 1,515,
'가 교체한다. –
경로는 무엇입니까? 나는 경로 디렉토리에 대해 혼란 스럽다. –
속성 파일 값'/ resources/styles/standard.css'로 바꿉니다. –