---
title: "关于RequestDispatcher定向与超链接问题"
author: "wikimo"
date: "2009-01-12T22:54:06Z"
tags: []
slug: "requestdispatcher"
draft: false
lastmod: "2009-01-12T22:54:06Z"
id: 315292
url: "https://wikimo.iteye.com/blog/315292"
---

**问题：**

在A文件夹下有b.html，c.jsp ，d.jsp，在b.html写了两个<a>通过Servlet分别最终利用RequestDispatcher重定向到c.jsp,d.jsp，在c.jsp，d.jsp中有返回b.html的链接，
此时，如果写的链接中有相对路径的话，可能会产生A/A/c.jsp,（实际需要A/c.jsp），就是多了一层A目录。

**解决方案：**

在<a>链接时写以/开头的绝对路径。