filter的dispatcher节点

时间:2021-08-05 11:16:00

1.FORWARD

(1)a.jsp页面内容如此<jsp:forward page="/b.jsp"></jsp:forward>

(2)

a.jsp页面内容如此<%@page errorPage="b.jsp" %>

<%
if(true)
{double d=3/0;
%>
<%=d%>
<%} %>

在web.xml中在<filter-mapping>中配置<dispatche>FORWARD</dispatche>

2.INCLUDE

a.jsp页面内容如此<jsp:include page="/b.jsp"></jsp:include>

在web.xml中在<filter-mapping>中配置<dispatche>INCLUDE</dispatche>

3.REQUEST

该方式为默认方式,若访问路径是a.jsp则filter不会工作,若访问路径是b.jsp则filter会工作

4.ERROR

<error-page>
<exception-type>java.lang.ArithmeticException</exception-type>
<location>/b.jsp</location>

</error-page>

在web.xml中在<filter-mapping>中配置<dispatche>ERROR</dispatche>