Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Progress Bar Issue in JSP

 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a JSP page which has a link for downloading. I have to show a progress bar when the user clicks on the link till the download box appears.

I have enclosed this link in a FORM tag, and the action for this tag is a Servlet which does the downloading part. Now since the action is not the same JSP, the progress bar isnt getting closed even after the download box appears. I cannot redirect to JSP page from the action servlet since the page takes a long time to reload.

How can I stop the progress bar without reloading the page again ?
Also, it is possible to reload the page parallely before the download box appears ?

Thanks,
Aditya
 
D Toney
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use AJAX for this purpose. On call back you can disable the progress bar, without reloading the page, using java script.
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello D Toney,

I was thinking of AJAX , but I've never used it. Can you give an example as to how I can use it here ?

Thanks,
Aditya
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing to do with JSP -- moved to the HTML forum.
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I tried using AJAX for the same. Somehow I am unable to get the response from the servlet.

Since the server side code already sets the contenttype as text/csv ( Since it is the code to write to CSV file), I am not getting the reponse from the server.

How can I get a response in this case ?

Thanks,
Aditya
 
vijin das
Ranch Hand
Posts: 129
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use dwr ajax framework for solving this

just check dwr website to learn how to use for your project dwrhome

i already found dwr sample here sample
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adi Kulkarni wrote:Hello,

I tried using AJAX for the same. Somehow I am unable to get the response from the servlet.

Since the server side code already sets the contenttype as text/csv ( Since it is the code to write to CSV file), I am not getting the reponse from the server.

How can I get a response in this case ?

Thanks,
Aditya


Without seeing your code, it is basically impossible to say why it fails.

Eric
 
Adi Kulkarni
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Eric ,

I need to do the following.

1: Click a link on the Jsp page to download to a CSV file.
2: After clicking this link, a progress animator should start till the download box appears.
3: The progress animator should get disabled once the box comes.

Now since the CSV downloading code is in a Servlet , we tried using AJAX for the same. But now the download box isnt coming. Following is the code sample we've tried.


JavaScript



Servlet Code




Kindly help,

Thanks,
Aditya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic