Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Theory Inquiry

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Theory Inquiry

    Community,

    If there are any gurus out there paying attention, maybe you can help me out?

    Lets say on a .jsp page, I have a button, which when clicked transfers the user to another .jsp page.
    While on the server, this 2nd jsp file starts executing a server side method (which could take a long time, and have many algorithms and calculations).

    My question is: would it be possible to somehow, while this long method is being executed, to relay messages back to a jsp page which would act as a logger. So, as the method is executing, the user would see a line by line log entry of the results/status of the method being run server side IN REAL TIME; not just a list of log entries returned AFTER the method is finished executing.

    Tried searching google, but without knowing what terminology properly describes the functionality I'm looking for, looking through all the search results is quite frankly futile.

    Anyone have any ideas?
    Brainstorming quite welcome, and any input would be appreciated.
    Thanks in advance.


  2. #2
    Junior Member
    Join Date
    Jul 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Theory Inquiry

    I was able to solve this problem using an older methodology of providing a .jsp page with a progress bar.

    By creating a java class that implements both Runnable and Serializable, you can create a function that is able to run on a seperate thread, and provide static messages and percentage of completion to a .jsp page that refreshes itself on a defined interval, thereby accessing updated messages and percentages from the object.

    Although, I did initially want a logger style functionality for the .jsp page, where all the status messages are logged in succession so the user can read them as they are populated, the functionality described above will suffice for the time being.

  3. #3
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Theory Inquiry

    You could also solve this by using AJAX which calls a servlet which provides the progress data which you then can use to render the progress bar.

    Another very cool way would be to use DWR - Easy Ajax for JAVA or Comet and have the web server push back the data to the JSP page in real time without having the browser refresh the page or use AJAX to call a servlet

    // Json

Similar Threads

  1. Problem with loop theory
    By Lord eMO in forum Loops & Control Statements
    Replies: 1
    Last Post: October 27th, 2017, 07:46 PM
  2. advanced java networking help/theory
    By wolfgar in forum Java Theory & Questions
    Replies: 2
    Last Post: February 7th, 2010, 07:02 PM
  3. [SOLVED] theory behind testing each element of an array.
    By etidd in forum Java Theory & Questions
    Replies: 2
    Last Post: February 5th, 2010, 09:04 AM
  4. Theory behind 2d Game making?
    By DarrenReeder in forum Java Theory & Questions
    Replies: 3
    Last Post: January 28th, 2010, 02:54 AM
  5. type substitution - whats the theory behind it
    By mds1256 in forum Java Theory & Questions
    Replies: 0
    Last Post: January 20th, 2010, 07:40 PM