jsp文件中获取项目真实路径

来源:互联网 发布:易语言赚钱源码 编辑:程序博客网 时间:2024/06/10 02:35
<!DOCTYPE html><%@ page contentType="text/html;charset=UTF-8" language="java" %><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%><%    String path = request.getContextPath();    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";    System.out.println(basePath);%>  <html><head></head>


输出basePath:

http://localhost:8080/



原创粉丝点击