服务器内不跳转,跳转目标在同一个工程下
servlet转到html
1.html转到servlet
2.servlet转到2.html
服务器短的页面跳转,地址栏不变
request.getRequestDispatcher("/2.html").forward(request, response);
servlet转到servlet
1.html转到servlet
2.servlet转到servlet1
3.servlet1转到2.html
1.html中代码:
<a href="/Tes/hello1">点击访问</a>
servlet中代码:
request.getRequestDispatcher("/hello2").forward(request, response);
servlet1中代码:
request.getRequestDispatcher("/2.html").forward(request, response);
2.html中代码:
<body>
<p > nihao </p>
<h1>注册成功!!</h1>
</body>