File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes problem with refresh button after sending mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with refresh button after sending mail" Watch "problem with refresh button after sending mail" New topic
Author

problem with refresh button after sending mail

lalith kumar
Greenhorn

Joined: May 09, 2008
Posts: 17
hi everybody,

I have successfully sent mail using java mail api but my problem is after sending mail if it returns success then i am sending it into success page. If i refresh that success page again and again mail will sent automatically.... How to avoid this if anyone knows please help me..... Its very urgent....


Thanks
Lalith
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

This is servlet / JSP related, so I'm moving this thread.

As for the answer, perhaps you can use a session. After the mail has been sent you set a flag indicating the mail has been sent. If the flag is set then don't send again.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi,

try redirecting to the succespage, instead of forwarding.

Herman
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

Please read this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61202
    
  66

Please read this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with refresh button after sending mail