• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Calling outside JSP code without waiting for its response.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All.
I have a JSP which calls an executable (written in C++) on the server. This executable does its thing and then returns me a value.
My problem is that the program takes a minute or so to run. I don't want the user to have to wait for the return value, because they don't really care about it. The servlet will basically kick off an email to the person with information obtained from the value above. So, my question is this: how can I call outside code (JSP or Servlet) from within my existing page and not have the existing page be "forwarded" to the next page.
For example:
test.jsp needs to execute program.jsp (which executes the C++ program above). test.jsp doesn't care what the return value will be from program.jsp. program.jsp will wait for the return value (Process.waitFor()) and then send an email.
This sounds a bit confusing, so let me try and say it again: I want page x to be able to launch code y which is contained in page/servlet z without affecting the output to the browser in page x.
Thoughts? If this is too confusing, please say so and I'll try to restate it.
 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have done this trick before.
You basically use a "hidden" frame to do all the work for you, with out having to move to a new page.
I have included code to show what I mean.
4 files:
- a frameset
- a main display page
- a placed holder page (so the DOM gets created properly on all browsers)
- a jsp, you have to plug this into your appserver





You should get the idea when you run it.
James.
 
Nothing? Or something? Like this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic