久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

spring MVC 項(xiàng)目 WEB-INF下的jsp不能加載css文件

 印度阿三17 2019-04-29

一.項(xiàng)目目錄

二.解決方法(已解決)

1. jsp文件加入

<link href="<c:url value="/css/main.css" />" rel="stylesheet"  type="text/css" />

<link rel="stylesheet" href="/app18b/css/main.css" type="text/css"><!-- app18b為項(xiàng)目名->

?或

<style>
    @import url("/app18b/css/main.css");
</style>

?

2.此時(shí)的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java./xml/ns/javaee"
xmlns:xsi="http://www./2001/XMLSchema-instance"
xsi:schemaLocation="http://java./xml/ns/javaee
 http://java./xml/ns/javaee/web-app_3_0.xsd">


<!-- static resources -->
<servlet-mapping>
  <servlet-name>default</servlet-name>
  <url-pattern>*.css</url-pattern>
  <url-pattern>*.js</url-pattern>
  <url-pattern>*.gif</url-pattern>
  <url-pattern>*.jpg</url-pattern>
  <url-pattern>*.jpeg</url-pattern>
  <url-pattern>*.png</url-pattern>
  <url-pattern>*.ico</url-pattern>
  <url-pattern>*.zip</url-pattern>
  <url-pattern>*.rar</url-pattern>
</servlet-mapping>

    <servlet>
        <servlet-name>springmvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/config/springmvc-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>springmvc</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    
    <jsp-config>
    <taglib>
    <taglib-uri>http://java./jsp/jstl/fmt</taglib-uri>
    <taglib-location>/WEB-INF/lib/fmt.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java./jsp/jstl/fmt-rt</taglib-uri>
    <taglib-location>/WEB-INF/lib/fmt-rt.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java./jsp/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/lib/c.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java./jsp/jstl/core-rt</taglib-uri>
    <taglib-location>/WEB-INF/lib/c-rt.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java./jsp/jstl/sql</taglib-uri>
    <taglib-location>/WEB-INF/lib/sql.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java./jsp/jstl/sql-rt</taglib-uri>
    <taglib-location>/WEB-INF/lib/sql-rt.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java./jsp/jstl/x</taglib-uri>
    <taglib-location>/WEB-INF/lib/x.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java./jsp/jstl/x-rt</taglib-uri>
    <taglib-location>/WEB-INF/lib/x-rt.tld</taglib-location>
    </taglib>
    </jsp-config>
</web-app>

此時(shí)的springmvc-config

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www./schema/beans"
    xmlns:xsi="http://www./2001/XMLSchema-instance"
    xmlns:p="http://www./schema/p"
    xmlns:mvc="http://www./schema/mvc"
    xmlns:context="http://www./schema/context"
    xsi:schemaLocation="
http://www./schema/beans
http://www./schema/beans/spring-beans.xsd
http://www./schema/mvc
http://www./schema/mvc/spring-mvc.xsd
http://www./schema/context
http://www./schema/context/spring-context.xsd">

    <!-- <context:component-scan
        base-package="app18b.controller" />
        <mvc:default-servlet-handler/>
    
    <mvc:annotation-driven></mvc:annotation-driven>
    <mvc:annotation-driven />
    靜態(tài)資源映射
<mvc:resources mapping="/css/**" location="/resources/css/"></mvc:resources>
<mvc:resources mapping="/js/**" location="/resource/js/"></mvc:resources>
<mvc:resources mapping="/img/**" location="/resource/img/"></mvc:resources>
<mvc:resources mapping="/uploads/**" location="/resource/uploads/"></mvc:resources>
     Register the bean
    <bean class="controller.ProductController" />
    <bean id="viewResolver"
              class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
        
    </bean> -->
    <context:component-scan base-package="controller"/>
<context:component-scan base-package="service"/>
<mvc:annotation-driven/>
<mvc:resources mapping="/css/ **" location="/css/"/>
<mvc:resources mapping="/ *.html" location="/"/>
 <!-- Register the bean -->
<!--     <bean class="controller.ProductController" /> -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
    
</beans>



    
        

?

來(lái)源:http://www./content-4-176501.html

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多