• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Continuous information from java class to jsp

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a java class that loops through a process to program a device and would like to update a webpage via a jsp.



The class is initiated by a jsp and I am looking to get the information from the logger.debug to come back to the jsp as it happens. This process lasts about 10 minutes in the loop.

Thanks
Jim
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not the way the web works. You send a request, you get a response.

What is traditionally done for long running processes:
  • A request initiaties a long-running process in a separate thread, or even in another program such as daemon.
  • A means is created for subsequent requests to get information about the process. Could just be a class that's available in the session that contains info like percentage of completion, or messages. Or the info could be stored in a database.
  • The response returns indicating that the process is started.
  • Create a way for users to submit requests to see the progress, or do so automatically at intervals. The request looks at the info in the "progress" class or database to know what the long-running process is doing, and can report it back to the front-end in the response.


  • Or you might want to look into web sockets, or Comet, but those're a bit of a can of worms.
     
    Jim Vanetten
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    That is what I though, are there any good tutorials I could look at?

    Thanks
    Jim
     
    Jim Vanetten
    Greenhorn
    Posts: 3
    • Likes 2
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Jim Vanetten wrote:That is what I though, are there any good tutorials I could look at?

    Thanks
    Jim



    Now that I knew what to look for I did find some good tutorials, thanks.
     
    Bear Bibeault
    Sheriff
    Posts: 67746
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    By the way, welcome to the Ranch!
    reply
      Bookmark Topic Watch Topic
    • New Topic