aspose file tools*
The moose likes JSP and the fly likes script before redirecting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "script before redirecting" Watch "script before redirecting" New topic
Author

script before redirecting

Singh Anisha
Ranch Hand

Joined: May 09, 2012
Posts: 100

Hi
i want to display a message(through alert box of JavaScript) if updation of record is successful and then user will redirected to main page.
i am updating the database through servlet then if updation will successfull response forwarded to another page which is required to display alertbox first and then will redirect user to main page.
but it's redirecting without showing alertbox.
I put the script in head tag but ...

How could i solve this problem.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Post an SSCCE showing the problem.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Singh Anisha
Ranch Hand

Joined: May 09, 2012
Posts: 100

UpdateServlet


success.jsp
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Well, yeah, you're redirecting. That means, don't go here, go there!
Singh Anisha
Ranch Hand

Joined: May 09, 2012
Posts: 100

Yes because i can achieve it through it from servlet so i required some intermediate JSP
but i want this redirection after displaying that alert box.

What to do to achieve that.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Personally, I'd be using Ajax to submit the operation so that I had complete control over what happens when it terminates, either successfully or not.

But to do it with pages, I'd probably suggest using JavaScript to perform the redirection after the alert. (Alert is blocking.) But that's all kind of primitive.
Singh Anisha
Ranch Hand

Joined: May 09, 2012
Posts: 100

:jumpingjoy:
Now its working the way i wanted.
Thank you very much.
 
 
subject: script before redirecting