java-jsp页面引入相对路径

 

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"
	scope="application" />
<script type="text/javascript"
	src="${ctx}/js/label.js"></script>

 需要导入两个包:

 

           jstl.jar  

           standard.jar 

在web.xml里添加
<jsp-config>  
        <taglib>  
            <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>  
            <taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location>  
        </taglib>  
        <taglib>  
            <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>  
            <taglib-location>/WEB-INF/tlds/fmt-rt.tld</taglib-location>  
        </taglib>     
< /jsp-config>

你可能感兴趣的:(java)