Can I stop JSP execution while in the midst of processing a request?

Govind Seshadri

Yes. Preemptive termination of request processing on an error condition is a good way to maximize the throughput of a high-volume JSP engine. The trick (asuming Java is your scripting language) is to use the return statement when you want to terminate further processing.

For example, consider:

      if (request.getParameter("foo") != null) {
          // generate some html or update bean property 
      } else {

      /* output some error message or provide redirection 
          back to the input form after creating a memento 
          bean updated with the 'valid' form elements that were input.
          this bean can now be used by the previous form to initialize 
          the input elements that were valid
          then, return from the body of the _jspService() method to 
          terminate further processing   */
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact