Response如何实现重定向

  @WebServlet(value = "/b")

  public class BServlet extends HttpServlet {

  @Override

  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

  //重定向通过请求方式获取数据

  String username=req.getParameter("username");

  System.out.println(username);

  }

  @Override

  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

  doGet(req,resp);

  }

  }