0

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).

Good Bye.

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by sam.n
0

Offhand it would be difficult to point out the actual cause of your application _not working_ but I guess the collection used to hold values is not getting updated or the DAO methods are returning rogue values in your case. Without more code, I don't think anyone would be as such able to lend a helping hand.

0

Hi
are u executing your code for fetching the comments in a separate thread inside this method?
DAO.getComments();

If yes..try removing thread.

I am not sure how you are implementing DAO....just a wild guess though.

Regards
sam.n

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.