原始问题:
java转发
if (url.startsWith("java:")) {
String path = url.substring(5);
// 将路径中的%20替换为空格
// path = StringUtil.replace(path, "%20", " ");
// 转发到指定的servlet处理器上
RequestDispatcher rd = request.getRequestDispatcher(path);
rd.forward(request, response);
} else {
//重定向 不能获取request中的数据
// response.sendRedirect(url); //重定向到新页面 可以传递参数 方法一:url传递参数 方法二:session传递参数
}
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
Prev:请想出一个名字必须符合以下要求