posted 19 years ago
Hi All!
I have a comments page. This page must display the list of comments stored in the database. This page contains two buttons. Add comment and Cancel. The Add Comment button takes us to the screen where you can type in a comment and save it.
Issue: When I add a new comment and return back to the comments page, it shows the newly added comment, which is right. When I hit the refresh button on the browser, the newly added comment is added once more. Everytime I click on the refresh buton, the comment keeps adding to the list.
My Action class:
if(request.getParameter("Add Comment")
{
return mapping.findForward("addComment");
} else if(request.getParameter("Cancel") {
return mapping.findForward("cancel");
}
return mapping.findForward("success");
So, After adding the comment and returning to this action class, the refresh button is calling this action in which the request parameter is still set to "addComment" and thats why a new comment is added everytime.
How do I fix this?