jsp页面中引入当前项目路径

 

方法:

1:${pageContext.request.contextPath}   jstl
2:或者<%=request.getContextPath()%>

 

 

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!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=UTF-8">
<title></title>

<link type="text/css" rel="stylesheet"
    href="${pageContext.request.contextPath}/public/styles/mainweb.css" />

 

你可能感兴趣的:(jsp)