JSP企业面试题及答案(选择题)(3)
时间:2025-07-08
时间:2025-07-08
JSP企业面试题及答案
C. String getParameterValuses(String name)
D.String[] getParameterValues(String name)
27. 设在表单中有一组复选钮标记,如下列代码:
<form action=”register.jsp”>请选择喜欢的城市:
<input type=”checkbox” name=”city” value=”长春”>长春 <br> <input type=”checkbox” name=”city” value=”北京”>北京 <br> <input type=”checkbox” name=”city” value=”大连”>大连 <br> <input type=”checkbox” name=”city” value=”上海”>上海 <br> </form>
如果在register.jsp是取city的值,最适合的方法为( )。
A. String city= request.getParameter(“city”);
B. String []cities=request.getParameter(“city”);
C. String []cities=request.getParameterValues(“city”);
D. String city=request.getAttribute(“city”);
28. J2EE中,( )用于返回应用程序的上下文路径。
A.HttpServletRequest类的getContextPath()方法
B.HttpServletRequset类的getPathInfo()方法
C.ServletContext类的getContextPath()方法
D.ServletContext类的getPathInfo()方法
29. 在J2EE中,使用Servlet过滤器时,需要在web.xml通过( )元素将
过滤器映射到Web资源。
A.<filter> B.<filter-mapping> C.<servlet> D.<servlet-mapping>
30. 给定一个JSP程序源代码,如下:
<jsp:include page="two.jsp" flush="true">
<jsp:param name="location" value="bejing"/>
</jsp:include>
在two.jsp中使用( )代码片段可以输出参数location的值。
A. <jsp:getParam name="location">
B. <jsp:getParameter name="location">
C. <%=request.getAttribute("location")%>
D. <%=request.getParameter("location")%>
31. 给定JSP程序源码如下:
<html> <% int count =1;%>
</html>
以下( )语句可以在下划线处插入,并且运行后输出结果是:1。
A.<%=++count %> B.<% ++count; %>
D.<% =count++ %> C.<% count++; %>
32. test.jsp文件中有如下一行代码:
<jsp:useBean id=”user” scope=”__” class=”erBean”>