为实现对test.jsp代码动作的监听,需要定义的监听器必须实现( )接口。<% getServletContext().setAttribute("username","hellking"); getServletContext().removeAttribute("username");%>
A. ServletContextListener
B. ServletContextAttributeListener
C. HttpServletContextListener
D. HttpServletContextAttributeListener
查看答案
给定程序片断:<% String value = "beanvalue"; %><% request.setAttribute("com.example.been",value); %><%--插入代码处--%>在第3行插入EL表达式( ),能够计算并输出"beanvalue"。
A. ${ value }
B. ${ com.example.been beanvalue }
C. ${ requestScope["com.example.been"] }
D. ${request.getAttribute("com.example.been").toString()}
假定在web应用中,请求参数productID包含产品的标识符,下面EL表达式( )能够计算productID的值。
A. ${productID}
B. ${param.productID}
C. ${params.productID}
D. ${params.productID[1]}
JSP页面运行时被JSP引擎转化为( )。
A. HTML文件
B. CGI文件
CSS文件
D. Servlet文件
设置session的有效时间(也叫超时时间)的方法是( )。
A. setMaxInactiveInterval(int interval)
B. getAttributeName()
C. setAttributeName(String name, java.lang.Object value)
D. getLastAccessedTime()