code015.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>setAttribute和getAttribute</title>
</head>
<body>
<%
try
{
int money = 100;
int number = 0;
request.setAttribute("result", money / number);
}
catch(Exception e)
{
request.setAttribute("result", "除数不能为0,页面出现异常");
}
%>
<jsp:forward page="code016.jsp" />
</body>
</html>