I have a question regarding a doPost method. I have made doPost method that executes a query on a db.
code:
try{
Statement st1 = con.createStatement();
PreparedStatement ps1=con.prepareStatement("INSERT into nota (Id_utilizator,Nume_reteta,Nota) values ((SELECT Id_user from user where E_mail = '"+request.getSession().getAttribute("email")+"'),(SELECT Nume FROM reteta where Nume = '"+retetaidd+"'),('"+nota+"'))");
ps1.executeUpdate();
response.sendRedirect(request.getRequestURI());
st1.close();
con.close();
ps1.close();
}
catch (Exception e2)
{
e2.printStackTrace();
}
Now I want that when my query is executed the page don't redirect to another page, I want to stay on the same page and the query to be executed. I know that I should replace
request.getRequestDispatcher("/health.jsp").forward(request, response);
but I don't know with what.Could anyone help me?Thanks