.
index主页代码
<body>
这是web下的index.html<br/>
<a href="a/b/c.html">a/b/c.html</a></br>
<a href="http://localhost:8088/07_Servlet/forwardC">请求转发:a/b/c.html</a>
</body>
.
Servlet-forwordC代码
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("经过了ForwardC程序");
req.getRequestDispatcher("/a/b/c.html").forward(req,resp);
}
.
c.html页面代码
<body>
这是a下的b下的c.html<br/>
<a href="http://localhost:8088/07_Servlet/index.html">返回首页</a>
</body>
.
.
通过base标签设置绝对的访问地址防止跳转时出错