SSM框架下引用前端layui框架

comi single blog(歡迎訪問我的個人博客,現開放註冊)

目錄結構

在這裏插入圖片描述

在是springmvc.xml文件下開啓過濾靜態資源

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="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 http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <!--開啓註解掃描,只掃描controller-->
    <context:component-scan base-package="club.twzw">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

    <!--配置視圖解析器-->
    <bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="suffix" value=".jsp"/>
        <property name="prefix" value="/WEB-INF/views/"/>
    </bean>

    <!--過濾靜態資源-->
    <mvc:resources mapping="/layui/**" location="WEB-INF/layui/"/>
    <!--        <mvc:resources mapping="/font/**" location="/font/"/>-->
    <!--        <mvc:resources mapping="/images/**" location="/images/"/>-->
    <!--        <mvc:resources mapping="/lay/**" location="/lay/"/>-->
    <!--        <mvc:resources mapping="/js/**" location="/js/"/>-->
    
    <!--開啓springmvc註解支持-->
    <mvc:annotation-driven/>
</beans>

頁面引用

	<link rel="stylesheet" href="layui/css/layui.css">
	<script src="layui/layui.js"></script>

最終效果

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章