There are mainly two types of questions :filter Filter sequence judgment ,html combination java Method judgment output
Question type 1 ,filter Filter sequence judgment ( Last year )
method :( I give a metaphysical method , Only applicable to insufficient review time , Students who do not understand the code ^_^, Can understand the same code learn , Do well in the exam )
Let's look at the following question :
Example 1 , There are two paragraphs in the text Filter.java code , a section Servlet.java code , a section xml code
notes :Filter Execution sequence and Filter stay web.xml The position in the file is irrelevant , Only and mapping The order of , Whose? mapping before , Just do it first
Problem solving steps :
(1) find Filter.java Medium doFilter Statements and chain sentence ,xml in <filter-mapping></filter-mapping> Under label MyFilter1,MyFilter2, The red part of the text
(2) Find out where chain Statement the output statement of the previous and next lines of the statement ( May be empty ),Servlet.java Output statements in , That is, the blue part
(3) We see xml in <filter-mapping></filter-mapping> Under label MyFilter,2 before 1 After , So we write the answers in this order :
MyFilter2.java Medium chain Output statement from previous line
——>MyFilter1.java Medium chain Output statement from previous line
——>Servlet.java Output statements in
——>MyFilter1.java Medium chain Output statement of the next line
——>MyFilter2.java Medium chain Output statement of the next line
( If we see xml in <filter-mapping></filter-mapping> Under label MyFilter,1 before 2 After , Then we write them in this order
answer :
MyFilter1.java Medium chain Output statement from previous line
——>MyFilter2.java Medium chain Output statement from previous line
——>Servlet.java Output statements in
——>MyFilter2.java Medium chain Output statement of the next line
——>MyFilter1.java Medium chain Output statement of the next line )
Question type II ,html combination java Method judgment output
These types of questions are generally not difficult , We just need to find all the output statements from the code , Then according to html Information in code , Will output variables in the statement , Output after assignment , Let's look at the following example
Example 1 :
be careful : Assignment shall be based on <context></context> Statement assignment in tag
Example 2 :
answer :
pageScope in user The value of is :itcast
requestScope in book The value of is :Java
sessionScope in user The value of is :it
apploicationScope in book The value of is :database
Technology