Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Threads in Java web app

Threads in Java web app

Hello again,

I am having trouble with a functionality in my java web application using PrimeFaces, I hope someone can guide me.

I launch a query in an Oracle database when I click a button (this query can last a little based in a date range the user selects)
so I have more or less this code:

CODE --> Java

ReportTh et  //This is my class extends Thread, where I write my report
public void genReport()
  //Here I connect with my database
  //I launch the report functionality as a Thread
  et = new ReportTh(date1, date2);
  //I start the thread
  Thread th = new Thread(et);
  //to make my sample more compact I do not write Exception, but I have them.


public void cancelReport()

When I call "genReport()" with a button, appears a loading bar and a "Cancel" button in case I want to cancel the report.
but if I do not want to, I cant get to dissapear my loading box and appear a new one with a "Download" button.
Here is my code for the buttons:

CODE --> Java

<p:commandButton id="genReport" value="Generar" widgetVar="genButton" actionListener="#{reportBean.genReport}" onclick="PF('statusDialog').show();" update="panel1"  icon="ui-icon-check" ajax="true" />

<p:dialog widgetVar="statusDialog" modal="true" draggable="false" closable="false" resizable="false" showHeader="false" >
   <h:panelGrid columns="1" cellpadding="2">
      <p:graphicImage name="ajaxloadingbar.gif" />
   <p:commandButton id="CancelReport" value="Cancelar" widgetVar="canButton" actionListener="#{electroBean.cancelReport}"/>

<p:dialog modal="true" resizable="false" header="Values" widgetVar="dlg" showEffect="fold">
   <p:panelGrid id="display" columns="2" columnClasses="label,value">
         <p:commandButton id="downloadLink" value="Descargar Report" widgetVar="desButton" >
              <p:fileDownload value="#{electroBean.prepDownload}" />

I Hope someone can guide me or tell me if my approaching is not the correct one, what can I research.

Thanks in advance.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close