Notes

JSP Best Practices Review

Ideal JSP Structure

Methods to Reduce Scriptlets in JSP:

  1. JSP Standard Actions
  2. Java Beans
  3. JSP EL (Expression Language)
  4. JSTL Tags
  5. Custom Tags

Java Beans Quick Review

Bean Structure

Java Bean = Fields + Constructor + Getter/Setter + Business Logic Methods

Bean Scopes (Lowest to Highest):

  1. Page Scope (default) → PageContext → Current page only
  2. Request Scope → HttpServletRequest → All pages where request is forwarded/included
  3. Session Scope → HttpSession → All pages for current user
  4. Application Scope (highest) → ServletContext → All pages for all users

Bean Usage Pattern: