JSP errorPage

<%@ page language="java" import="java.util.*" errorPage="error.jsp" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
    <%=1+1 %><br>
    <%="zhangsan" %><br>
    <%=Math.PI %><br>
    <br>
    <%
    	String str="zhangsan";
    	out.println(str+"lisa");
     %>
     <%=str %><br>
     <%
     	 for(int i=1;i<10;i++){
     	 	for(int j=1;j<=i;j++){
     	 		out.print(j+"*"+i+"="+i*j+"&nbsp");
     	 	}
     	 	out.println("<br>");
     	 }
      %>
      <%!
      		int num=100;
      		public String display(){
      			return "zhangsan";
      		}
       %>
       <%=display() %><br>
       <%=num %>
       <%--这是jsp注释 --%>
       <!-- 这是html注释 -->
       <%=10/0 %>
  </body>
</html>
<%@ page language="java" import="java.util.*" isErrorPage="true" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'error.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <%="This is a errorPage!" %>
  </body>
</html>


你可能感兴趣的:(JSP errorPage)