Servlet Class Converted from UseBean.jspx

This section describes the Servlet class converted from the UseBean.jspx JSP page. The converted Java Servlet class shows how 'useBean', 'setProperty' and 'getProperty' are converted.

If you are interested to see how Tomcat 7 server converts "useBean", "setProperty" and "getProperty" action elements into Java statements before the final execution, open the Servlet class converted from UseBean.jspx:

package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import herong.CacheBean;

public final class UseBean_jspx 
    extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final javax.servlet.jsp.JspFactory _jspxFactory =

  private static java.util.Map<java.lang.String,java.lang.Long> 

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.Map<java.lang.String,java.lang.Long> 
    getDependants() {
    return _jspx_dependants;

  public void _jspInit() {

  public void _jspDestroy() {

  public void _jspService(
        final javax.servlet.http.HttpServletRequest request, 
        final javax.servlet.http.HttpServletResponse response)
        throws, javax.servlet.ServletException {

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;

    try {
      pageContext = _jspxFactory.getPageContext(
         this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;


      CacheBean b = null;
      b = (CacheBean) _jspx_page_context.getAttribute("b", 
      if (b == null){
        b = new CacheBean();
        _jspx_page_context.setAttribute("b", b, 

         _jspx_page_context.findAttribute("b"), "text", 
         "Hello world!", null, null, false);

      out.write("Property from my JavaBean: \n");


      out.write("Info from my JavaBean: \n");
    } catch (java.lang.Throwable t) {
    } finally {

Note that:

Last update: 2012.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

 Tomcat 7 Installation on Windows Systems

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

 Syntax of JSP Pages and JSP Documents

 JSP Application Session

 Managing Cookies in JSP Pages

JavaBean Objects and "useBean" Action Elements

 What Is a JavaBean?

 "jsp:useBean" Action Elements

Servlet Class Converted from UseBean.jspx

 Setting and Getting JavaBean's Properties

 Using JavaBean Objects in Scripting Elements

 Using Java Objects as JavaBeans

 getProperty() Error on Tomcat 7

 Refreshing Loaded JavaBean Classes

 Importing Unnamed Package Class Error

 Using JavaBean without Import Element Error

 Creating JavaBean Classes in Named Packages

 "NoClassDefFoundError" Exception

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

 EL (Expression Language)

 Overview of JSTL (JSP Standard Tag Libraries)

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

 File Upload Test Application

 Outdated Tutorials


 PDF Printing Version