建立一个test11对象 <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> </head> <body> <h1>pagecontext</h1> <hr> 用户名:<%=pageContext.getSession().getAttribute("username") %><br> <% //跳转到注册页面 //pageContext.forward("test08.jsp"); pageContext.include("include.jsp"); %> </body> </html>建立一个include对象 <%@ page language="java" import="java.util.*,java.text.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path=request.getContextPath(); String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; Date date=new Date(); SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日"); String s=sdf.format(date); out.println(s); %>