日期:2014-05-18  浏览次数:20677 次

问几道servlet 和 jsp 的面试题
1. which two prevent a servlet from handling requests?
A the servlet's init method returns a non-zero status
B the servlet's init method throws a Servlet Exception
C the servlet's init method sets the Servlet Response's context length to 0
D the servlet's init method sets the Servlet Response's context type to null
E the servlet's init method does not return within a time period defined by the servlet container

2. which 3 occur during JSP page translation 
A JspInit method is called
B Jsp page implementation class is created
C Jsp page implementation class is compiled
D the Jsp page is validated for syntaic correctness

3. Given an EL function foo,in namespace func , that requires a long as parameter and returns a Map
A ${func(1)}
B ${foo:func(4)}
C ${func:foo(2)}
D ${foo(5):func}
E ${func:foo("easy")}
F ${func:foo("3").name}

4. which can make the data be synchronized
A none of them
B store the data in a vocal var
C store the data in an instance var

5. servlet A receives a request that it forwards to Servlet B whithin another web application in the same web container.
Servlet A needs to share data with Servlet B and that data must not be visible to other servlets in A's web application.
A HttpSession
B ServletConfig
C servletContext
D HttpServletRequest
E HttpServletResponse


一共有29题,这5题不太懂,望请高手做答,谢谢

------解决方案--------------------
5.d
------解决方案--------------------
1.b,E
servlet规范中如下规定:
The servlet container cannot place the servlet into service if the init method :

Throws a ServletException 
Does not return within a time period defined by the Web server 


------解决方案--------------------
1. B E
2. B C D
5. B