---
title: "默认的index.jsp里的参数解释"
author: "zhou_wu"
date: "2010-08-26T15:55:38Z"
tags: []
categories: ["编程语言"]
slug: "index-jsp"
draft: false
lastmod: "2010-08-26T15:55:38Z"
id: 747920
url: "https://leesmart.iteye.com/blog/747920"
---

建立一个web项目TestMyEclipse:

(1).String path = request.getContextPath();
//拿到的是TestMyEclipse 即是新建项目时url访问的路径 一般跟项目名一样

(2).String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
//http://127.0.0.1:8080/TestMyEclipse

(3).  <base href="<%=basePath%>">
      <a href="aaa.html"></a>
     //连接的实际地址为 http://127.0.0.1:8080/TestMyEclipse/aaa.html