i have worked with php for over 2 years now ,i have just recently shifted to my first project in java
i have a form on which i am redirecting to servlet though post, here is the code.
public class Login extends HttpServlet {
private static final long serialVersionUID = 1L;
@Autowired
EnfantsHibernateDAO enfantsdao;
public Login() {
super();
// TODO Auto-generated constructor stub
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("/WEB-INF/views/dashboard.jsp").forward(request,response);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getRequestDispatcher("/WEB-INF/views/dashboard.jsp").forward(req, resp);
}
now inside doPost method i am calling a jsp page, which loads just fine i am facing an issue, after loading the dashboard.jsp from doPost when i refresh the dashboard.jsp page it shows me the form re submission alert,
now working with php what i do is redirect to another method from the post method and then load the view from that other method so that i may not get form re submission error, my question is how i can i achieve something similar with servlet?