При вызовк сервлета возникает ошибка Cannot call sendRedirect() after the response has been committed
ума не приложу что бы это могло значить
Добавлено через 3 минуты и 45 секунд
| Код | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String firstName = req.getParameter("firstName"); String lastName = req.getParameter("lastName"); String login = req.getParameter("login"); String password = req.getParameter("password"); Right right = Right.valueOf(req.getParameter("right")); if(firstName.equals("")||lastName.equals("")||login.equals("")||password.equals("")) resp.sendRedirect("registration.jsp"); try { LoginService loginService = new LoginService(); if (loginService.isThisLogin(login))//если такой логин уже есть { resp.sendRedirect("registration.jsp"); } else { loginService.addAccount(login, password, firstName, lastName, right); req.getRequestDispatcher("login.jsp").forward(req, resp); } } catch (JAXBException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
|
ругается на первые 2 перенаправления |