String username = request.getParameter("username");//获取参数值
if (username != null && username.length() > 0) { RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/response"); //获取url为/response的servlet作为转发的对象 if (dispatcher != null) { dispatcher.include(request, response); //请求转发到response这个url对应的servlet } } out.println("</body></html>"); } }