服务器端-进度栏

I am currently working on a file conversion program, once the file has been uploaded it will convert the file to different file formats(ppt,pdf) this will usually take long depending on the file size. Since the file conversion is happening on the back end, I want the user to see the progress of the file conversion( something like progress bar eg "52% file being converted") is there anyway I can display to the user the current progress of the file conversion(that's happening on the back end)? During file conversion I am only able to show the status(in numbers(provided by the API I am using))

I have no idea where to start can someone provide some insight or approach?

You're saying: During file conversion I am only able to show the status(in numbers(provided by the API I am using))

What is this number? Is percentage of how much of a file is converted? If it is, then you only need to import jQuery UI library and add .progressbar()

If you are using Struts2 take a look at Execute and Wait Interceptor. It creates new thread with your task which will be executed in the background while you can show some progress to the user.

In struts.xml file add execAndWait interceptor to your long running action and define two results wait and success.

<action name="longRunningAction" class="...">
  <interceptor-ref name="defaultStack"/>
  <interceptor-ref name="execAndWait"/>
  <result name="wait">longRunningAction-wait.jsp</result>
  <result name="success">longRunningAction-success.jsp</result>
</action>

You still need to poll this action in your JSP via AJAX or simple page refresh.

Simple Solution: Use Struts2-Jquery tag

And define indicator on your submit tag with a gif image

eg.

 `<form action="...">
     <s:file ..../>
     <sj:submit indicator="imgId"> 
 </form>

 <img id="imgId" src="images/indicator.gif" alt="Loading..."     
  style="display:none"/>
     `