This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Continuous information from java class to jsp  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
 
Marshal
Posts: 67241
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
    • 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
    • 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
    Marshal
    Posts: 67241
    170
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    By the way, welcome to the Ranch!
     
    Beware the other head of science - it bites! Nibble on this message:
    Become a Java guru with IntelliJ IDEA
    https://www.jetbrains.com/idea/
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!