1.页面a.jsp有异常抛到error.jsp页面显示我是用
JSP设置值与JSTL读取值 或是JSTL设置值然后通过JSP来读取
<%
String newImg="yes";
request.setAttribute("newImg",newImg); //设置
%>
${newImg} //读取
//设置
${newImg1} //读取
<%= pageContext.getAttribute("newImg1")%> //读取
统计的错误页面代码:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isErrorPage = "true"%>
<%@ taglib prefix="c" uri="" %>
<% pageContext.setAttribute("error",exception.getMessage()); %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
错误页面
使用JSTL + EL标签
现在的全部页面JSP都是用JSTL+EL标签实现的!
OK!
阅读(946) | 评论(0) | 转发(0) |