SSM框架整合后js、css失效问题

1.在SpringMVC.xml中添加如下代码

    
    <mvc:default-servlet-handler />
    <mvc:resources location="/WEB-INF/static/" mapping="/**" /> 

2.在jsp页面引入c标签

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}">c:set>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

3.在引入js、css时使用c标签

<link rel="stylesheet" href="${ctx}/style.css" type="text/css"></link>

你可能感兴趣的:(SSM框架)