c8_005f1_jsp.java

来自「Internet 开发技术分章节代码和自己完成的课程设计全代码(在zuoye文件」· Java 代码 · 共 94 行

JAVA
94
字号
package org.apache.jsp;

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

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

  private static java.util.List _jspx_dependants;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=GBK");
      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;

      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head><title>JSP中使用Bean</title></head>\r\n");
      out.write("<body>\r\n");
      ch8Bean.c8_1 myBean = null;
      synchronized (_jspx_page_context) {
        myBean = (ch8Bean.c8_1) _jspx_page_context.getAttribute("myBean", PageContext.PAGE_SCOPE);
        if (myBean == null){
          myBean = new ch8Bean.c8_1();
          _jspx_page_context.setAttribute("myBean", myBean, PageContext.PAGE_SCOPE);
        }
      }
      out.write(" \r\n");
      out.write("   <h3> 在JSP中使用一个具有简单属性的JavaBean的例子</h3><hr>\r\n");
      out.write("   第一次调用getAa1()和getBb1()的值:\r\n");
      out.write("   ");
      out.print(myBean.getAa1());
      out.write("\r\n");
      out.write("   ");
      out.print(myBean.isBb1());
      out.write("\r\n");
      out.write("    <p>修改aa1与bb1后调用getAa1()和getBb1()的值:\r\n");
      out.write("   ");
      org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("myBean"), "aa1", "5", null, null, false);
      out.write("\r\n");
      out.write("   <br>  ");
      out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((ch8Bean.c8_1)_jspx_page_context.findAttribute("myBean")).getAa1())));
      out.write("\r\n");
      out.write("   ");
      org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("myBean"), "bb1", "true", null, null, false);
      out.write("\r\n");
      out.write("   ");
      out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((ch8Bean.c8_1)_jspx_page_context.findAttribute("myBean")).isBb1())));
      out.write("\r\n");
      out.write("   <p>调add()方法,返回值是:\r\n");
      out.write("    ");
      out.print(myBean.add());
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html> ");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?