日期:2014-05-16  浏览次数:20422 次

JSP入门的简单学习

我的第一个JSP文件是非常简单的JSP,如下:

<%@page import="java.util.Date"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>JSP</title>

</head>

<body>

<%="hello" %>

</body>

</html>

 

我使用的是Tomcat7.0服务器,加载到Eclipse后,会编译我上面的JSP文件,把该JSP文件通过编译器编译成一个

Servlet的java文件,如下图:

package org.apache.jsp;

import javax.servlet.*;

import javax.servlet.http.*;

import javax.servlet.jsp.*;

import java.util.Date;

public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase

    implements org.apache.jasper.runtime.JspSourceDependent {

 

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

          javax.servlet.jsp.JspFactory.getDefaultFactory();

 

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

 

  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() {

    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();

    _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());

  }

 

  public void _jspDestroy() {

  }

 

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

        throws java.io.IOException, javax.servlet.ServletException {

 

    final javax.servlet.jsp.PageContext pageContext;

    javax.servlet.http.HttpSession session = null;

    final javax.servlet.ServletCo