日期:2014-05-16 浏览次数:20401 次
<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <base href="<%=basePath%>">
<base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <meta http-equiv="Cache-Control" content="no-store"/> <meta http-equiv="Pragma" content="no-cache"/> <meta http-equiv="Expires" content="0"/> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE6" />
<html> <head> <title>标准DOM示例</title> <%@ include file="/common/meta.jsp" %> ....
<link rel="stylesheet" href="style/mystyle.css" type="text/css"> <script src="scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="../style/mystyle.css" type="text/css"> <script src="../scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %> <%@ taglib uri = "http://java.sun.com/jsp/jstl/xml" prefix = "x" %> <%@ taglib uri = "http://java.sun.com/jsp/jstl/fmt" prefix = "f" %> <%@ taglib uri = "http://java.sun.com/jsp/jstl/sql" prefix = "sql" %> <%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
System.out.println(Thread.currentThread().getContextClassLoader().getResource("")); System.out.println(FileTest.class.getClassLoader().getResource("")); System.out.println(ClassLoader.getSystemResource("")); System.out.println(FileTest.class.getResource("")); System.out.println(FileTest.class.getResource("/")); //Class文件所在路径 System.out.println(new File("/").getAbsolutePath()); System.out.println(System.getProperty("user.dir"));
/** * TODO 取得当前项目的根目录 * @author <a href="mailto:pheh.lin@gmail.com">PHeH</a><br> * Created On 2006-12-30 17:15:41 */ public class Application { /** * TODO 获取根目录 * @return * @author <a href="mailto:pheh.lin@gmail.com">PHeH</a><br> * Created On 2007-5-10 15:16:21 */ public static String getRootPath(){ //因为类名为"Application",因此" Appl