Home > Articles

Quick Hints

  • Print
  • + Share This

Quick hints

When developing JSP pages, try to keep business logic off the JSP page and in the back-end JavaBeans that the JSP page makes reference to. Nothing clutters up the source JSP more than a lot of complicated computation or complex flow control.

If you need to stop processing on a JSP page, so that none of the rest of the page is displayed or JSP directives processed, just use "return." Because the JSP page is actually turned into a class method, calling return terminates the entire page.

If you're going to do a redirect using the Response object on a JSP page, it needs to occur before any output has been sent to the browser, otherwise it won't work.

If you're using JDBC in conjunction with JSP, be sure to keep track of your open connections. Database connection leaks are the source of many mysterious site failures.

When creating a JSP page, which will be included in a number of other pages (for example, a standard header or footer), you might not want variables used on that page to interfere with a variable of the same name used on the main page. You can avoid this problem by putting "<% { %>" at the top of the included page and "<% } %>" at the bottom.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.