• 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

stop executing of a servlet by another servlet

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

Is there a way in which I can stop the executing of a function in servlet by settling some attribute in session using another servlet.
For eg:
In jsp < %session.setAttribute('cancel',"") %> On submit button I am calling a servlet which has following code
servlet1 -->(String str = session.getAttribute(cancel) ){ if (str.equals(somevalue) break;}

Now tht 'someValue' is set in session using servlet2 which is invoked on some button Click of jsp
servlet2 -->session.setAttribute('cancel',someValue)
Howver I am getting str as null always in servlet1 even after invoking servlet2.

Please note that I am using encodeURL to maintain the session.
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ketaki,

welcome to java ranch !!

I think No.

Once you send request to your Servlet after finish the request and clients get response you get control for another process.
 
ketaki gujarathi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.. is there no way where i can stop executing the function of a servlet on some external action (For Eg on Cancel button click )...
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly is the function that you want to stop?

Is it being executed by the Thread that called the servlet originally or has a new Thread been created?

Are both servlets in the same web application?

Bill
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without knowing the answers to the questions asked by William, it is hard to provide answers.

As Nishan states, the normal processing through a web application is a request generates a response, which does not allow the possibility of user canceling the operation.

This might be bypassed in the cases of a lengthy server side process by utilizing Ajax requests. In which case, as long as you develop something server side to handle this, the client browser would still be responding to user interactions, so it could send some another request to the server to tell it to cancel the job. You would have to ensure that interrupting the server process did not result in invalid data on the server side.
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:What exactly is the function that you want to stop?


My guess - the report process that Manisha is also asking about - apparently it is taking some time for the report to be built on the server before it gets sent to the client.
 
It's exactly the same and completely different as this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic