Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Refresh causing to submit form again

843841May 28 2003 — edited Jul 9 2003
the submitted form goes to my servlet which inserts a record into my database. Then forwards to a completely different page using the RequestDispatcher.forward method which sends the HttpServletRequest and HttpServletResponse along with it (which is needed).

My problem is when I refresh the "forwarded" page , it submits the form again. Why is this happening, it shouldn't submit the form again, I'm confused as to why this is happening. Any help would be appreciated.

Here's some code that may or may not help :

when the form is submitted this is the method in the servlet that creates new record :

private void create_Ticket_close(HttpServletRequest request, HttpServletResponse response, String remoteUser){

//grab parameters
//initialize and define objects
//update object

//call method for displaying the forwarded page
this.display_GetTicket(request, response, ticket.getId());

}

private void display_GetTicket(HttpServletRequest request, HttpServletResponse response, int ticketId) {

//get object from database

//set the Object to the request
request.setAttribute("r_ticket", ticket);

ServletContext context = this.getServletConfig().getServletContext();
RequestDispatcher dispatcher = context.getRequestDispatcher("/form/openTicketService.jsp");

dispatcher.forward(request, response);

}

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 6 2003
Added on May 28 2003
9 comments
970 views