Hi Shashwati!

Off late, i came accross the same situation,  and give tell u how did i
solve this..

When u come to the page page which adds a record to the table, come with a
parameter from previous page, let's say parameter 'addToken=yes' and add
record only if request.getParameter(("addToken").equals("yes")) and after
successful addition set addToken=no

This prevents addition of duplicate records with key hit F5

Hope this helps u

regards

venkat


----- Original Message -----
From: "Shashwati Panigrahi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 02, 2001 4:36 AM
Subject: Re-execution of servlet


> Hi All,
>
> I am describing my situation below.
> I have a page called AddTicket.jsp, which sends all the ticket related
data
> entered by the user to the servlet AddTicket.java.
>
> Now AddTicket.java creates a new ticket id by fecthing the maximum ticket
id
> from the database and adding 1 to it.
>
> Then AddTicket.java inserts the record which consists of parameters
received
> from the jsp as well as the ticket_id generated. If the insert is
successful
> then it sends a message to the message page using the following code
>
>         ServletContext sc=getServletContext();
>         RequestDispatcher rd = sc.getRequestDispatcher(/jsp/Message.jsp);
>         rd.forward(req,res);
>
> Now when the record is inserted then the Message is displayed on the
message
> page whereas the URL on the browser is still that of the servlet.
>
> When I press F5 at this juncture, the servlet AddTicket re-executes thus
> creating another record with the next ticket id but all the data is same
as
> the previous one. I want to prevent executing this servlet at this point
> when I refresh the page. What should I do and how should I go about it.
>
> I hope someone can help me fast
>
> Thanks in Advance
> Shashwati
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to