I am writing a web based application using JSP and JDBC. In side a servlet I execute some code like this
DAO.addComments( commentsBean ); commentsList = DAO.getComments(); session.setAttribute( "comments", commentsList ); response.sendRedirect( "comments.jsp" );
when I move to comments.jsp I find all the comments except those that have been just added by the servlet code written above using addComments(). The next time I access the same page "comments.jsp" that missing comments appear.
The same problem occurs when I delete some comments, the deleted comments still appear on the comments.jps page when I visit the page just after deleting the comments form inside the servlet by calling the DAO method.
So many thanks if someone could guide me properly, about what is the issue (problem).