jsp试题高分 15
17.下面这一段JSP代码片断的输出结果是(B);<%!inti=1;%><%!IntgetNumber(){returni;}%><%inti=10;out.print...
17.下面这一段JSP代码片断的输出结果是(B);
<%! int i=1;%>
<%! Int getNumber(){
return i; }
%>
<% int i=10;
out.println(“first i=”+i);
%>
<% out.println(“second i=”+i); %>
<% out.println(“third i=”+getNumber()); %>
A . first i=10 second i=10 third i=10
B. first i=10 second i=10 third i=1
C first i=10 second i=1 third i=10
D first i=1 second i=1 third i=1
18.给定jsp2.jsp文件代码片断,如下:
<%
String username=request.getParameter(“User”);
out.println(“Username is “+username+”<br>”);
%>
另外要编写jsp1.jsp,在其中嵌入jsp2.jsp中内容,并且要求运行jsp1.jsp时,浏览器页面上输出:Username is King
要满足以上条件,以下(A)语句适合用于jsp1.jsp中。
A. <jsp:include page=”jsp2.jsp” flush=”true”>
<jsp:param name=”User” value=”King”/>
</jsp:include>
B. <%@ include file=”jsp2.jsp?User=King”%>
C. <% pageContext.setAttribute(“User”,”King”);%>
<jsp :include page= “jsp2.jsp” flush= “ true”/>
D. <%pageContext.setAttribute(“User”,”King”);%>
<%@ include file= “jsp2.jsp ”%>
19.在Servlet 里,获取session 的正确方法是(A)。
A. HttpSession session=request.getSession();
B. HttpSession session=request.getHttpSession(true);
C. HttpSession session=response.getSession();
D. HttpSession session=response.getHttpSession(true);
20.在 JSP中,(A)动作用于将请求转发给其他 JSP 页面。
A . forward
B. include
C. useBean
D. setProperty
21.在J2EE中,以下不是JSP隐式对象的是(B);
A. pageContext
B. context
C. application
D. out
22.要设置某个JSP页面为错误处理页面,以下page指令正确的是(B)
A.<%@ page errorPage= “true”%>
B.<%@ page isErrorPage= “ true”%>
C.<% @ page extends= “ javax.servlet.jsp.JspErrorPage”%>
D <%@ page info= “ error”%> 展开
<%! int i=1;%>
<%! Int getNumber(){
return i; }
%>
<% int i=10;
out.println(“first i=”+i);
%>
<% out.println(“second i=”+i); %>
<% out.println(“third i=”+getNumber()); %>
A . first i=10 second i=10 third i=10
B. first i=10 second i=10 third i=1
C first i=10 second i=1 third i=10
D first i=1 second i=1 third i=1
18.给定jsp2.jsp文件代码片断,如下:
<%
String username=request.getParameter(“User”);
out.println(“Username is “+username+”<br>”);
%>
另外要编写jsp1.jsp,在其中嵌入jsp2.jsp中内容,并且要求运行jsp1.jsp时,浏览器页面上输出:Username is King
要满足以上条件,以下(A)语句适合用于jsp1.jsp中。
A. <jsp:include page=”jsp2.jsp” flush=”true”>
<jsp:param name=”User” value=”King”/>
</jsp:include>
B. <%@ include file=”jsp2.jsp?User=King”%>
C. <% pageContext.setAttribute(“User”,”King”);%>
<jsp :include page= “jsp2.jsp” flush= “ true”/>
D. <%pageContext.setAttribute(“User”,”King”);%>
<%@ include file= “jsp2.jsp ”%>
19.在Servlet 里,获取session 的正确方法是(A)。
A. HttpSession session=request.getSession();
B. HttpSession session=request.getHttpSession(true);
C. HttpSession session=response.getSession();
D. HttpSession session=response.getHttpSession(true);
20.在 JSP中,(A)动作用于将请求转发给其他 JSP 页面。
A . forward
B. include
C. useBean
D. setProperty
21.在J2EE中,以下不是JSP隐式对象的是(B);
A. pageContext
B. context
C. application
D. out
22.要设置某个JSP页面为错误处理页面,以下page指令正确的是(B)
A.<%@ page errorPage= “true”%>
B.<%@ page isErrorPage= “ true”%>
C.<% @ page extends= “ javax.servlet.jsp.JspErrorPage”%>
D <%@ page info= “ error”%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询