protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text/html"); response.setCharacterEncoding("utf-8"); Category category = new Category(); category.add(new String(request.getParameter("name").getBytes("iso-8859-1"), "utf-8")); response.getWriter().println("<script>alert('添加成功');window.location.href='admin/category.jsp'</script>"); }我這里是用window.location.href 腳本操作返回頁面。這樣合理嗎?
jsp提交表單后跳轉到servlet,然后用什么方式返回到表單頁面?
aluckdog
2018-10-12 18:19:04