Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

1)在JSP中,要定義一個方法,需要用到以下()元素。(選擇一項)

a)  <%=  %>                                                              b)  <%   %>

c)  <%!  %>                                                                     d)  <%@  %>

2)JSP頁面經過編譯之後,將建立一個()。(選擇一項)

a)  applet                                                                     b)  servlet

c)  application                                                              d)  exe檔案

3)當JSP頁面執行自定義標籤,遇到結束標籤時將呼叫()方法執行處理。(選擇一項)

a)  doStartTag()                                                            b)  doEndTag()

c)  doInitBody()                                                           d)  doAfterBody()

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}

4) 在J2EE中,test.jsp檔案中有如下一行程式碼:(選擇一項)

<jsp:useBean id=”user” scope=”_____” type=”com.UserBean”/>

要使user物件中一直存在於對話中,直至其終止或被刪除為止,下劃線中應填入()。

a)  page                                                                          b)  request

c)  session                                                                      d)  application

5) 在J2EE中,以下不是JSP隱式物件的是()。(選擇一項)

a)  pageContext                                                             b)  context

c)  application                                                                d)  out

6) Servlet中,HttpServletResponse的()方法用來把一個Http請求重定向到另外的URL。(選擇一項)

a)   sendURL()                                                               b)   redirectURL()

c)   sendRedirect()                                                          d)   redirectResponse()

7) 在JSP中,page指令的()屬性用來引入需要的包或類。(選擇一項)

a)   extends                                                                   b)   import

c)   languge                                                                   d)   contentType

8) 在Servlet過濾器的生命週期方法中,每當傳遞請求或響應時,web容器會呼叫()方法。(選擇一項)

a)   init                                                                        b)  service

c)  doFilter                                                                     d)  destroy

9) 在JSP中,只有一行程式碼:<%=’A’+’B’%>,執行將輸出()。(選擇一項)

a)  A+B                                                               b)  AB

c)  131                                                                  d)  錯誤資訊,因為表示式是錯誤的

10給定一個Servlet的程式碼片段如下:

Public void doGet(HttpServletRequest request,HttpServletResponse response)

throws ServletException,IOException{    

______

out.println(“hi kitty!”);

out.close();

}

執行次Servlet時輸出如下:

hi kitty!

則應在此Servlet下劃線處填充如下程式碼。(選項一項)

a)    PrintWriter out = response.getWriter();

       b)    PrintWriter out = request.getWriter();

       c)    OutputStream out = response.getOutputStream();

d)    OutputStream out = request.getWriter();

11給定如下JSP程式碼,假定在瀏覽器中輸入URL:http://localhost:8080/web/jsp1.jsp,可以呼叫這個JSP,那麼這個JSP的輸出是()。(選項一項)

<%@ page contentType="text/html; charset=GBK" %>

<%@ taglib uri=”http://java.sun.com/jsp/jstl/core”  prefix=”c”%>

<html>

<body>

<% int counter = 10;  %>

<c:if test=”${counter%2==1}”>

<c:set var=”isOdd” value=”true”></c:set>

</c:if>

<c:choose>

<c:when test=”${isOdd==true}”>it’s an odd </c:when>

<c:otherwise>it’s an even </c:otherwise>

</c:choose>

</body>

</html>

a)    一個HTML頁面,頁面上顯示it’s an odd

       b)    一個HTML頁面,頁面上顯示it’s an even

       c)    一個空白的HTML頁面

d)    錯誤資訊

12) 給定java程式User.java,程式碼如下:

package user;

public class User{

private String password;

private String loginName;

public String getLoginName(){

return loginName;

}

public String getPassword(){

return password;

}

public void setLoginName(String loginName){

this.loginName=loginName;

}

public void setPassword(String password){

this.password=password;

}

}

給定user.jsp,程式碼片斷如下:

____________

loginName:     <jsp:getProperty name=”user” property=”loginName”/>

password:       <jsp:getProperty name=”user” property=”password”/>

在瀏覽器上輸入URL:http://localhost/user,jsp?loginName=sa&password=sa並回車

要使瀏覽器上顯示:

loginName: sa  password: sa

在user.jsp中的下劃線處應填入以下()程式碼.      (選擇一項)

a)    <jsp:useBean id=”user” class=”user.User” scope=”page”/>

<jsp:setProperty name=”user” property=”loginName” value=”*”/>

<jsp:setProperty name=”user” property=”password” value=”*”/>

b)    <jsp:useBean id=”user” class=”user.User” scope=”application”/>

<jsp:setProperty name=”user” property=”loginName” value=”*”/>

<jsp:setProperty name=”user” property=”password” value=”*”/>

c)    <jsp:useBean id=”user” class=”user.User” scope=” application”/>

<jsp:setProperty name=”user” property=”*” />

d)    <jsp:useBean id=”user” class=”user.User” scope=” page”/>

<jsp:setProperty name=”user” property=”*” />

13)  某JSP程式中宣告使用javaBean的語句如下:

<jsp:useBean id=”user” class=”mypackage.User” scope=”pge”/>

要取出該javaBean的loginName屬性值,以下語句正確的是().      (選擇兩項)

a)    <jsp:getProperty name=”user” property=”loginName’/>

b)    <jsp:getProperty id=”user’ property=”loginName”/>

c)    <%=user.getLoginName()%>

d)    <%=user.getProperty(“loginName”)%>

14) J2EE中,以下關於HttpServlet的說法錯誤的是()。(選擇一項)

a)  HttpServlet是一個抽象類

b)  HttpServlet類擴充套件了GenericServlet類

c)  HttpServlet類的子類必須至少重寫service方法

d)  HttpServlet位於javax.servlet.http包中

15)給頂一個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")%>

16)J2EE中,JSP EL表示式:s{(10*10) ne 100}的值是()。(選擇一項)

a)  0                                   b)  True

c)  False                               d)  1

17)在J2EE中,test.jsp檔案如下:

<html>

<%{%>

<jsp:useBean    id="buffer"scope="page"    type="java.lang.StringBuffer"/>

<%  buffer.append("ABC");%>

<%}%> buffer    is  <%=buffer%>

</html>

執行時,將發生()。    (選擇一項)

a)  轉譯期錯誤                          b)  執行期錯誤

c)  執行後,瀏覽器上顯示:buffer is null

d)  執行後,瀏覽器上顯示:buffer is ABC

18)  如JSP頁面執行時遇到自定義標籤,doStartTag()方法將被呼叫()次。(選擇一項)

a)  1                                                                          b)  1或多

c)  0或1                                                                    d)  0或多

19)  給定include1.jsp檔案程式碼片斷,如下:

<% pageContext.setAttribute("User","HAHA");%>

_______//此處填寫程式碼

給定include2.jsp檔案程式碼片斷,如下:

<%=pageContext.getAttribute("User")%>

要求執行include1.jsp時,瀏覽器上輸出:HAHA

要滿足以上條件,jsp1.jsp中下劃線處應填入以下()語句。(選擇一項)

a)   <jsp:include page="include2.jsp" flush="true"/>

b)   <%@ include file="include2.jsp"%>

c)   <jsp:forword page="include2.jsp"/>

d)   <% response.sendRedirect("include2.jsp");%>

20)在J2EE中,在web.xml中,有如下程式碼:

<session - config>

<session - timeout>30</session - timeout>

</session - config>

上述程式碼定義了預設的會話超時時長,時長為30(    )。(選擇一項)

a)       毫秒                                                         b) 秒

c)  分鐘                                                        d) 小時

21)  在inc.jsp中包含數行程式碼與一張圖片,現在要建立一個home.jsp,每次瀏覽home.jsp時都能夠以最快的速度顯示inc.jsp中的所有內容以及home.jsp自身要顯示的內容,應該在home.jsp中使用的語句是(    )。(選擇一項)

a) <%@include file = “inc.jsp”%>                       b)<%@include page=“inc.jsp”flush= “true”>

c) <jsp:include file = “inc.jsp”flush = “false”> d) <jsp:forward page = “inc.jsp”/>

22)   給定一個JSP程式原始碼如下:

<jsp:include page = “two.jsp”flush = “true”>

<jsp:param name = “location”value = “beijing”/>

</jsp:include>

在two.jsp中加入(   )程式碼片斷可以輸出引數location的值。(選擇一項)

a)       <jsp:getParam name = “location”>         b) <jsp:getParameter name = “location”>

c)  <% = request.getAttribute(“location”)%>  d)<% = request.getParameter(“location”)%>

23)使用自定義標籤時,要為JSP引擎提供有關自定義標籤的相關資訊,下列資訊描述語句正確的是(   )。(選擇一項)

a)<tag>

<name>hello</name>

<tag-class>com.tagdemo.HelloTag</tag-class>

</tag>

b)<taglib>

<name>hello</name>

<tag-class>com.tagdemo.HelloTag</tag-class>

</taglib>

c)<tag-info>

<name>hello</name>

<tagclass>com.tagdemo.HelloTag</tagclass>

</tag-info>

d)<tag-desc>

<name>hello</name>

<tagclass>com.tagdemo.HelloTag</tagclass>

</tag-desc>

24) 要設定某個JSP頁面為錯誤處理頁面,以下page指令正確的是()。   (選擇一項)

a) <%@ page errorPage="true"%>                     b)    <%@ page isErrorPage="true"%>

c)  <%@ page extends="javax.servlet.jsp.JspErrorPage"%>

d)  <%@ page info="error"%>

25)JavaMail是一組用於傳送和接收郵件訊息的API。傳送郵件使用()協議,接收郵件使用()協議。   (選擇一項)

a)       POP3  SMTP                                                 b)   POP3  TCP

c)       SMTP  TCP                                             d)   SMTP  POP3

26) Servlet裡,能正確獲取session的語句是()。   (選擇一項)

a)       HttpSession session = request.getSession(true);

b)              HttpSession session = request.getHttpSession(true);

c)       HttpSession session = response.getSession(true);

d)              HttpSession session = response. getHttpSession (true);

27) JSP,()動作用於將請求轉發給其他JSP頁面。   (選擇一項)

a)       forward                                   b)           include

c)       useBean                                                    d)           setProperty

28) J2EE在一個JSP檔案中有表示式<%=2+3 %>它將輸出()   (選擇一項)

a)       2+3                                                          b)  5                   

c)       23                                                            d)  不會輸出,因為表示式是錯誤的

29) J2EE實現企業級應用開發中,()是描述標記庫的XML文件。   (選擇一項)

a)    TLD檔案                                                 b)  DTD檔案

c  )      WAR檔案                                                d)  EAR檔案

30) 給定JSP程式原始碼如下,可以在下劃線處插入並且能夠正確輸出WELCOMEJACK的語句是()。   (選擇二項)

<html>

<body>

<%  String name="JACK"; %>

WELCOME______

</body></html>

a)       name                                                        b)           <%=name%>

c)       out.println(name);                                     d)           <% out.println(name); %>

31)J2EE中,重定向到另一個頁面,以下()語句是正確的。   (選擇一項)

a)    request.sendRedirect("http://www.jb-aptech.com.cn");

b)    request.sendRedirect();

c)    response.sendRedirect("http://www.jb-aptech.com.cn");

d)    response.sendRedirect();

32) JSP中,使用<jsp:useBean>動作可以將javaBean嵌入JSP頁面,對JavaBean的訪問範圍不能是()。   (選擇一項)

a)    page                                                        b)    request

c)    response                                                   d)    application

33) J2EE中,使用Servlet過濾器時,可以在web.xml檔案的()元素中包括<init-param>元素。   (選擇一項)

a)   <filter>                                                    b)    <filter-mapping>

c)    <filter-name>                                          d)   <filter-class>

34) Servlet中,使用()介面中定義的()方法來處理客戶端發出的表單資料請求 (選一項)

a)  HttpServlet  doHead                                 b)  HttpServlet  doPost

c)  ServletRequest  doGet                               d)  ServletRequest  doPost

35) 給定JSP程式原始碼如下,該JSP執行後輸出的結果是()。   (選擇一項)

<html>

  <% int count =1;%> Count: <% ++count; %>

</html>

a)  Count:1                                      b)  Count:2

c)  1:2                                             d)  Count:

36) 給定如下Servlet程式碼假定在瀏覽器中輸入URLhttp://localhost:8080/servlet/HelloServlet可以呼叫這個servlet那麼這個Servlet的輸出是()

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

public class HelloServlet extends HttpServlet{

    public void service(HttpServletRequest req, HttpServletResponse res)

    throws ServletException, IOException{

    }

    public void doGet(HttpServletRequest req, HttpServletResponse res)

    throws ServletException, IOException {

        res.setContentType("text/html");

        PrintWriter out = res.getWriter();

        out.println("<html>");

        out.println("<body>");

        out.println("doGet Hello World!");

        out.println("</body>");

        out.println("</html>");

        out.close();

    }

    public void doPost(HttpServletRequest req, HttpServletResponse res)

    throws ServletException, IOException {

        res.setContentType("text/html");

        PrintWriter out = res.getWriter();

        out.println("<html>");

        out.println("<body>");

        out.println("doPost Hello World!");

        out.println("</body>");

    }

}   (選擇一項)

a) 一個HTML頁面,頁面上顯示doGet Hello World!

b) 一個HTML頁面,頁面上顯示doPost Hello World!

c) 一個空白的HTML頁面

d) 錯誤資訊

37) 在J2EE中,request物件的(  )方法可以獲取頁面請求中一個表單元件對應多個值時的使用者的請求資料。(選擇一項)

a)        String getParameter(String name)

b)       String[] getParameter(String name)

c)        String getParameterValuses(String name)

d)       String[] getParameterValues(String name)

38)(  )是傳送郵件的協議。(選擇一項)

a) SMTP                                                               b) LAMP

c) POP3                                                                 d) HTTP

39) WEB應用中,常用的會話跟蹤方法不包括()。(選擇一項)

a) URL重寫                                                        b) Cookie

c) 隱藏表單域                                                     d) 有狀態HTTP協議

40)   在J2EE中,${2 + “4”}將輸出()。(選擇一項)

a)       2 + 4                                                               b) 6

c)  24                                                              d) 不會輸出,因為表示式是錯誤的

41)   在J2EE的Model Ⅱ模式中,模型層物件被編寫為()。(選擇一項)

a)  Applet                                                            b) JSP

c)  Server                                                             d) JavaBean

42)   J2EE中,JSP EL 表示式:${user.loginName}執行效果等同於()。(選擇一項)

a)  <% = user.getLoginName()%>                           b)  <%user.getLoginName();%>

c)  <% = user.loginName%>                                          d)  <% user.loginName;%>

43)   J2EE中,()類()方法用於返回應用程式的上下文路徑。(選擇一項)

a)  HttpServletRequest、getContextPath()                b)  HttpServletRequset、getPathInfo()

c)  ServletContext、getContextPath()                     d)  ServletContext、getPathInfo()

44)   在J2EE中,使用Servlet過濾器時,需要在web.xml通過()元素將過濾器對映到Web資源。(選擇一項)

a)         <filter>                                                           b)  <filter-mapping>

c)  <servlet>                                                          d)  <servlet-mapping>

45)   給定JSP程式原始碼如下:

<html>

<% int count =1;%> _______

</html>

以下()語句可以在下劃線處插入,並且執行後輸出結果是:1。       (選擇一項)

a)  <%=++count %>                                              b) <% ++count; %>

c)  <% count++; %>                                           d) <% =count++ %>

46)   在J2EE中,在web.xml中定義過濾器時可以指定初始化引數,以下定義正確的是()(選擇一項)

a)         <filter>

<filter-name>someFilter</filter-name>

<filter-class>filters.SomeFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>EUC_JP</param-value>

</init-param>

</filter>

b)        <filter>

<fiter-name>someFilter</filter-name>

<init-param>

<param-name>encoding</param-name>

<plaram-value>EUC_JP</param-value>

</init-param>

</filter>

c)         <filter-mapping>

<filter-name>someFilter</filter-name>

<init-param>

<param-name>encoding</param-name>

<param-value>EUC_JP</param-value>

</init-param>

</filter-mapping>

d)        <filter-mapping>

<filter-name>someFilter</filter-name>

<filter-class>filters.SomeFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>EUC_JP</param-value>

</init-param>

</filter-mapping>

47) servlet 的生命週期又一系列事件組成,把這些事件按照先後順序排序,以下正確的是()(選擇一項)

a)  載入類,例項化,請求處理,初始化,銷燬

b)  載入類,例項化,初始化,請求處理,銷燬

c)  例項化,載入類,初始化,請求處理,銷燬

d)  載入類,初始化,例項化,請求處理,銷燬

48)   在J2EE中,給定某Servlet的程式碼如下,編譯執行該檔案,以下陳述正確的是()。(選擇一項)

Public class Servlet1 extends HttpServlet{

Public void init() throws ServletException{

}

Public void service(HttpServletRequest request,HttpServletResponse response)

Throws ServletException,IOException{

PrintWriter out = response.getWriter();

Out.println(“hello!”);

}

}

a)             編譯該檔案時會提示缺少doGet()或者dopost()方法,編譯不能夠成功通過

b)            編譯後,把Servlet1.class放在正確位置,執行該Servlet,在瀏覽器中會看到輸出文字:hello!

c)             編譯後,把Servlet1.class放在正確位置,執行該Servlet,在瀏覽器中看不到任何輸出的文字

d)  編譯後,把Servlet1.class放在正確位置,執行該Servlet,在瀏覽器中會看到執行期錯誤資訊

49)某web應用的上下文路徑是root,配置檔案web.xml中有如下片段:

<servlet>

<servlet-name>process</servlet-name>

<servlet-class>slt.ProcessServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>process</servlet-name>

<url-pattern>/proc</url-pattern>

</servlet-mapping>

以下說法正確的是()。(選擇二項)

a)         在包slt中,有一個名為ProcessServlet.class的檔案

b)        該servlet的訪問路徑是http://機器IP:埠號/root/proc

c)         該servlet的訪問路徑是http://機器IP:埠號/root/ProcessServlet

d)        該servlet的訪問路徑是http://機器IP:埠號/root/ProcessServlet

50) 在J2EE中,test.jsp檔案中有如下一行程式碼:

<jsp:useBean id=”user” scope=”__” type=”com.UserBean”>

要使user物件可以作用於整個應用程式,下劃線中應添入()。(選擇一項)

a)  page                                                               b)  request

c)  session                                                             d)  application

1)在J2EE中,<%=2+4%>將輸出(6)。(選擇一項)

a) 2+4

b) 6

c) 24

d) 不會輸出,因為表示式是錯誤的

2)在J2EE中,request物件的()方法可以獲取頁面請求中一個表單元件對應多個值時的使用者的請求資料。(選擇一項)

a) String   getParameter(String name)

b) String[] getParameter(String name)

c) String   getParameterValues(String name)

d) String[]      getParameterValues(String name)

3)()是傳送郵件的協議。(選擇一項)

a) SMTP

b) IAMP

c) POP3

d) HTTP

4)J2EE中,JSP EL表示式:${user.loginName}的執行效果等同於()。(選擇一項)

a) <%=user.getLoginName()%>

b) <% user.getLoginName();%>

c) <%=user.loginName%>

d) <% user.loginName;%>

5) 在J2EE中,test.jsp檔案中有如下一行程式碼:

<jsp:useBean id=”user”scope=”_”type=”com.UserBean”/>

要使user物件只能在使用test.jsp時使用,當載入頁面時就會將其銷燬。下劃線中應填入()。(選擇一項)

a) page

b) request

c) session

d) application

6)要設計一個大型的基於多層體系結構的web應用系統,系統介面端基於HTML和XML,

該系統要不斷的進行版本升級(即日後維護、二次需求開發等任務量較大),要達成這些目

標,最適合的開發模式是()。(選擇一項)

a) DAO

b) ValueObject

c) MVC

d) Proxy

7) 在J2EE中,使用Servlet過濾器時,需要在web.xml通過()元素將過濾器對映到Web資源。(選擇一項)

a) <filter>

b) <filter-mapping>

c) <servlet>

d) <servlet-mapping>

8)在J2EE的Model II模式中,模型層物件被編寫為()。(選擇一項)

a) Applet

b) JSP

c) Servlet

d) JavaBean

9) J2EE中,()類的()方法用於返回應用程式的上下文路徑。(選擇一項)

a) HttpServletRequest、getContextPath()

b) HttpServletRequest、getPathInfo()

c) ServlettContext、getContextPath()

d) ServlettContext、getPathInfo()

10)Web應用中,常用的會話跟蹤方法不包括()。(選擇一項)

a) URL重寫

b) Cookie

c) 隱藏表單域

d) 有狀態HTTP協議

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

針對以下題目請選擇正確的答案(每道題目有一個或多哥正確的答案)。每一道題目,所有答案都選對,則該題加分,所選答案錯誤或不能選出所有正確答案,則該題不得分。
1)在JSP中,要定義一個方法,需要用到以下()元素。(選擇一項)

a)  <%= 
%>                                                              b)  <%  
%>

c)  <%! 
%>                                                                      d) 
<%@  %>

2)JSP頁面經過編譯之後,將建立一個()。(選擇一項)

a)  applet                                                                     b)  servlet

c)  application                                                              d)  exe檔案

3)當JSP頁面執行自定義標籤,遇到結束標籤時將呼叫()方法執行處理。(選擇一項)

a)  doStartTag()                                                            b) 
doEndTag()

c)  doInitBody()                                                          
d)  doAfterBody()

4) 在J2EE中,test.jsp檔案中有如下一行程式碼:(選擇一項)

<jsp:useBean
id=”user” scope=”_____” type=”com.UserBean”/>

要使user物件中一直存在於對話中,直至其終止或被刪除為止,下劃線中應填入()。

a) 
page                                                                          b) 
request

c) 
session                                                                     
d)  application

5) 在J2EE中,以下不是JSP隱式物件的是()。(選擇一項)

a)  pageContext                                                           
 b) 
context

c) 
application                                                                d)  out

6) Servlet中,HttpServletResponse的()方法用來把一個Http請求重定向到另外的URL。(選擇一項)

a)   sendURL()                                                               b)  
redirectURL()

c)  
sendRedirect()                                                         
d)   redirectResponse()

7) 在JSP中,page指令的()屬性用來引入需要的包或類。(選擇一項)

a)  
extends                                                                   b)  
import

c)  
languge                                                                  
d)   contentType

8) 在Servlet過濾器的生命週期方法中,每當傳遞請求或響應時,web容器會呼叫()方法。(選擇一項)

a)  
init                                                                        b) 
service

c) 
doFilter                                                                    
d)  destroy

9) 在JSP中,只有一行程式碼:<%=’A’+’B’%>,執行將輸出()。(選擇一項)

a)  A+B                                                               b) 
AB

c)  131                                                                  d) 
錯誤資訊,因為表示式是錯誤的

10給定一個Servlet的程式碼片段如下:

Public
void doGet(HttpServletRequest request,HttpServletResponse response)

throws ServletException,IOException{    

______

out.println(“hi
kitty!”);

out.close();

}

執行次Servlet時輸出如下:

hi kitty!

則應在此Servlet下劃線處填充如下程式碼。(選項一項)

a)    PrintWriter out =
response.getWriter();

       b)    PrintWriter out =
request.getWriter();

       c)    OutputStream out =
response.getOutputStream();

d)    OutputStream out =
request.getWriter();

11給定如下JSP程式碼,假定在瀏覽器中輸入URL:http://localhost:8080/web/jsp1.jsp,可以呼叫這個JSP,那麼這個JSP的輸出是()。(選項一項)

<%@
page contentType="text/html; charset=GBK" %>

<%@
taglib uri=”http://java.sun.com/jsp/jstl/core” 
prefix=”c”%>

<html>

<body>

<%
int counter = 10;  %>

<c:if
test=”${counter%2==1}”>

<c:set
var=”isOdd” value=”true”></c:set>

</c:if>

<c:choose>

<c:when
test=”${isOdd==true}”>it’s an odd </c:when>

<c:otherwise>it’s
an even </c:otherwise>

</c:choose>

</body>

</html>

a)    一個HTML頁面,頁面上顯示it’s an odd

       b)    一個HTML頁面,頁面上顯示it’s an even

       c)    一個空白的HTML頁面

d)    錯誤資訊

12) 給定java程式User.java,程式碼如下:

package user;

public class User{

private
String password;

private String
loginName;

public String
getLoginName(){

return loginName;

}

public String getPassword(){

return
password;

}

public void setLoginName(String
loginName){

this.loginName=loginName;

}

public void setPassword(String
password){

this.password=password;

}

}

給定user.jsp,程式碼片斷如下:

____________

loginName:     <jsp:getProperty
name=”user” property=”loginName”/>

password:       <jsp:getProperty
name=”user” property=”password”/>

在瀏覽器上輸入URL:http://localhost/user,jsp?loginName=sa&password=sa並回車

要使瀏覽器上顯示:

loginName: sa  password: sa

在user.jsp中的下劃線處應填入以下()程式碼.      (選擇一項)

a)    <jsp:useBean id=”user”
class=”user.User” scope=”page”/>

<jsp:setProperty
name=”user” property=”loginName” value=”*”/>

<jsp:setProperty
name=”user” property=”password” value=”*”/>

b)    <jsp:useBean id=”user”
class=”user.User” scope=”application”/>

<jsp:setProperty
name=”user” property=”loginName” value=”*”/>

<jsp:setProperty
name=”user” property=”password” value=”*”/>

c)    <jsp:useBean id=”user”
class=”user.User” scope=” application”/>

<jsp:setProperty
name=”user” property=”*” />

d)    <jsp:useBean id=”user”
class=”user.User” scope=” page”/>

<jsp:setProperty
name=”user” property=”*” />

13)  某JSP程式中宣告使用javaBean的語句如下:

<jsp:useBean id=”user”
class=”mypackage.User” scope=”pge”/>

要取出該javaBean的loginName屬性值,以下語句正確的是().      (選擇兩項)

a)    <jsp:getProperty name=”user” property=”loginName’/>

b)    <jsp:getProperty id=”user’ property=”loginName”/>

c)    <%=user.getLoginName()%>

d)    <%=user.getProperty(“loginName”)%>

14) J2EE中,以下關於HttpServlet的說法錯誤的是()。(選擇一項)

a)  HttpServlet是一個抽象類

b)  HttpServlet類擴充套件了GenericServlet類

c)  HttpServlet類的子類必須至少重寫service方法

d)  HttpServlet位於javax.servlet.http包中

15)給頂一個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")%>

16)J2EE中,JSP EL表示式:s{(10*10) ne 100}的值是()。(選擇一項)

a)  0                                   b)  True

c)  False                               d)  1

17)在J2EE中,test.jsp檔案如下:

<html>

<%{%>

<jsp:useBean    id="buffer"scope="page"    type="java.lang.StringBuffer"/>

<%  buffer.append("ABC");%>

<%}%> buffer    is  <%=buffer%>

</html>

執行時,將發生()。    (選擇一項)

a)  轉譯期錯誤                          b)  執行期錯誤

c)  執行後,瀏覽器上顯示:buffer is null

d)  執行後,瀏覽器上顯示:buffer is ABC

18)  如JSP頁面執行時遇到自定義標籤,doStartTag()方法將被呼叫()次。(選擇一項)

a)  1                                                                          b)  1或多

c)  0或1                                                                    d) 
0或多

19)  給定include1.jsp檔案程式碼片斷,如下:

<%
pageContext.setAttribute("User","HAHA");%>

_______//此處填寫程式碼

給定include2.jsp檔案程式碼片斷,如下:

<%=pageContext.getAttribute("User")%>

要求執行include1.jsp時,瀏覽器上輸出:HAHA

要滿足以上條件,jsp1.jsp中下劃線處應填入以下()語句。(選擇一項)

a)   <jsp:include
page="include2.jsp" flush="true"/>

b)  
<%@ include file="include2.jsp"%>

c)   <jsp:forword
page="include2.jsp"/>

d)   <%
response.sendRedirect("include2.jsp");%>

20)在J2EE中,在web.xml中,有如下程式碼:

<session - config>

<session
- timeout>30</session - timeout>

</session - config>

上述程式碼定義了預設的會話超時時長,時長為30(    )。(選擇一項)

a)      
毫秒                                                         b) 秒

c)  分鐘                                                        d)
小時

21)  在inc.jsp中包含數行程式碼與一張圖片,現在要建立一個home.jsp,每次瀏覽home.jsp時都能夠以最快的速度顯示inc.jsp中的所有內容以及home.jsp自身要顯示的內容,應該在home.jsp中使用的語句是(    )。(選擇一項)

a) <%@include
file = “inc.jsp”%
>                       b)<%@include page=“inc.jsp”flush= “true”>

c) <jsp:include
file = “inc.jsp”flush = “false”> d) <jsp:forward page = “inc.jsp”/>

22)  
給定一個JSP程式原始碼如下:

<jsp:include page = “two.jsp”flush
= “true”>

<jsp:param name = “location”value
= “beijing”/>

</jsp:include>

在two.jsp中加入(   )程式碼片斷可以輸出引數location的值。(選擇一項)

a)      
<jsp:getParam name = “location”>         b) <jsp:getParameter name = “location”>

c) 
<% = request.getAttribute(“location”)%>  d)<% = request.getParameter(“location”)%>

23)使用自定義標籤時,要為JSP引擎提供有關自定義標籤的相關資訊,下列資訊描述語句正確的是(   )。(選擇一項)

a)<tag>

<name>hello</name>

<tag-class>com.tagdemo.HelloTag</tag-class>

</tag>

b)<taglib>

<name>hello</name>

<tag-class>com.tagdemo.HelloTag</tag-class>

</taglib>

c)<tag-info>

<name>hello</name>

<tagclass>com.tagdemo.HelloTag</tagclass>

</tag-info>

d)<tag-desc>

<name>hello</name>

<tagclass>com.tagdemo.HelloTag</tagclass>

</tag-desc>

24) 要設定某個JSP頁面為錯誤處理頁面,以下page指令正確的是()。   (選擇一項)

a)
<%@ page
errorPage="true"%>                     b)    <%@
page isErrorPage="true"%>

c)  <%@ page
extends="javax.servlet.jsp.JspErrorPage"%>

d)  <%@ page
info="error"%>

25)JavaMail是一組用於傳送和接收郵件訊息的API。傳送郵件使用()協議,接收郵件使用()協議。   (選擇一項)

a)       POP3  SMTP                                                 b)   POP3  TCP

c)       SMTP 
TCP                                             d)   SMTP  POP3

26) Servlet裡,能正確獲取session的語句是()。   (選擇一項)

a)       HttpSession session = request.getSession(true);

b)              HttpSession session =
request.getHttpSession(true);

c)       HttpSession session =
response.getSession(true);

d)              HttpSession session =
response. getHttpSession (true);

27) JSP,()動作用於將請求轉發給其他JSP頁面。  
(
選擇一項)

a)       forward                                   b)           include

c)       useBean                                                    d)           setProperty

28) J2EE在一個JSP檔案中有表示式<%=2+3 %>它將輸出()  
(選擇一項)

a)       2+3                                                          b)  5                   

c)       23                                                            d)  不會輸出,因為表示式是錯誤的

29) J2EE實現企業級應用開發中,()是描述標記庫的XML文件。   (選擇一項)

a)    TLD檔案                                                 b)  DTD檔案

c  )      WAR檔案                                                d) 
EAR檔案

30) 給定JSP程式原始碼如下,可以在下劃線處插入並且能夠正確輸出WELCOMEJACK的語句是()。   (選擇二項)

<html>

<body>

<%  String name="JACK"; %>

WELCOME______

</body></html>

a)       name                                                        b)           <%=name%>

c)       out.println(name);                                     d)           <%
out.println(name); %>

31)J2EE中,重定向到另一個頁面,以下()語句是正確的。   (選擇一項)

a)    request.sendRedirect("http://www.jb-aptech.com.cn");

b)    request.sendRedirect();

c)    response.sendRedirect("http://www.jb-aptech.com.cn");

d)    response.sendRedirect();

32) JSP中,使用<jsp:useBean>動作可以將javaBean嵌入JSP頁面,對JavaBean的訪問範圍不能是()。   (選擇一項)

a)    page                                                        b)    request

c)    response                                                   d)    application

33) J2EE中,使用Servlet過濾器時,可以在web.xml檔案的()元素中包括<init-param>元素。   (選擇一項)

a)   <filter>                                                    b)    <filter-mapping>

c)    <filter-name>                                          d)
  <filter-class>

34)
Servlet
中,使用()介面中定義的()方法來處理客戶端發出的表單資料請求 (選一項)

a)  HttpServlet  doHead                                 b)  HttpServlet  doPost

c)  ServletRequest  doGet                               d)  ServletRequest  doPost

35) 給定JSP程式原始碼如下,該JSP執行後輸出的結果是()。   (選擇一項)

<html>

  <% int count =1;%> Count: <% ++count;
%>

</html>

a)  Count:1                                      b)
 Count:2

c)  1:2                                             d)  Count:

36) 給定如下Servlet程式碼假定在瀏覽器中輸入URLhttp://localhost:8080/servlet/HelloServlet可以呼叫這個servlet那麼這個Servlet的輸出是()

import java.io.*;

import javax.servlet.*;

import
javax.servlet.http.*;

public
class HelloServlet extends HttpServlet{

    public void service(HttpServletRequest req,
HttpServletResponse res)

    throws ServletException, IOException{

    }

    public void doGet(HttpServletRequest req,
HttpServletResponse res)

    throws ServletException, IOException {

       
res.setContentType("text/html");

        PrintWriter out = res.getWriter();

        out.println("<html>");

        out.println("<body>");

        out.println("doGet Hello
World!");

        out.println("</body>");

        out.println("</html>");

        out.close();

    }

    public void doPost(HttpServletRequest req,
HttpServletResponse res)

    throws ServletException, IOException {

       
res.setContentType("text/html");

        PrintWriter out = res.getWriter();

        out.println("<html>");

        out.println("<body>");

        out.println("doPost Hello
World!");

        out.println("</body>");

    }

}   (選擇一項)

a) 一個HTML頁面,頁面上顯示doGet Hello World!

b) 一個HTML頁面,頁面上顯示doPost Hello World!

c) 一個空白的HTML頁面

d) 錯誤資訊

37) 在J2EE中,request物件的(  )方法可以獲取頁面請求中一個表單元件對應多個值時的使用者的請求資料。(選擇一項)

a)       
String getParameter(String name)

b)      
String[] getParameter(String name)

c)       
String getParameterValuses(String name)

d)      
String[] getParameterValues(String name)

38)(  )是傳送郵件的協議。(選擇一項)

a) SMTP                                                               b) LAMP

c) POP3                                                                 d)
HTTP

39) WEB應用中,常用的會話跟蹤方法不包括()。(選擇一項)

a) URL重寫                                                        b)
Cookie

c) 隱藏表單域                                                     d) 有狀態HTTP協議

40)  
在J2EE中,${2 + “4”}將輸出()。(選擇一項)

a)      
2 + 4                                                               b) 6

c)  24     
                                                        d) 不會輸出,因為表示式是錯誤的

41)  
在J2EE的Model Ⅱ模式中,模型層物件被編寫為()。(選擇一項)

a)  Applet 
                                                          b) JSP

c)  Server                                                             d) JavaBean

42)  
J2EE中,JSP EL 表示式:${user.loginName}執行效果等同於()。(選擇一項)

a)  <% = user.getLoginName()%>                           b)  <%user.getLoginName();%>

c)  <% = user.loginName%>                                          d)  <% user.loginName;%>

43)  
J2EE中,()類()方法用於返回應用程式的上下文路徑。(選擇一項)

a)  HttpServletRequest、getContextPath()                b) 
HttpServletRequset、getPathInfo()

c)  ServletContext、getContextPath()                     d) 
ServletContext、getPathInfo()

44)  
在J2EE中,使用Servlet過濾器時,需要在web.xml通過()元素將過濾器對映到Web資源。(選擇一項)

a)        
<filter>                                                           b)  <filter-mapping>

c) 
<servlet>                                                          d)  <servlet-mapping>

45)  
給定JSP程式原始碼如下:

<html>

<%
int count =1;%> _______

</html>

以下()語句可以在下劃線處插入,並且執行後輸出結果是:1。       (選擇一項)

a)  <%=++count %>                                              b) <% ++count; %>

c)  <% count++; %>                                           d) <% =count++ %>

46)  
在J2EE中,在web.xml中定義過濾器時可以指定初始化引數,以下定義正確的是()(選擇一項)

a)        
<filter>

<filter-name>someFilter</filter-name>

<filter-class>filters.SomeFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>EUC_JP</param-value>

</init-param>

</filter>

b)       
<filter>

<fiter-name>someFilter</filter-name>

<init-param>

<param-name>encoding</param-name>

<plaram-value>EUC_JP</param-value>

</init-param>

</filter>

c)        
<filter-mapping>

<filter-name>someFilter</filter-name>

<init-param>

<param-name>encoding</param-name>

<param-value>EUC_JP</param-value>

</init-param>

</filter-mapping>

d)       
<filter-mapping>

<filter-name>someFilter</filter-name>

<filter-class>filters.SomeFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>EUC_JP</param-value>

</init-param>

</filter-mapping>

47) servlet 的生命週期又一系列事件組成,把這些事件按照先後順序排序,以下正確的是()(選擇一項)

a) 
載入類,例項化,請求處理,初始化,銷燬

b)  載入類,例項化,初始化,請求處理,銷燬

c) 
例項化,載入類,初始化,請求處理,銷燬

d) 
載入類,初始化,例項化,請求處理,銷燬

48)  
在J2EE中,給定某Servlet的程式碼如下,編譯執行該檔案,以下陳述正確的是()。(選擇一項)

Public class Servlet1 extends
HttpServlet{

Public
void init() throws ServletException{

}

Public
void service(HttpServletRequest request,HttpServletResponse response)

Throws
ServletException,IOException{

PrintWriter out = response.getWriter();

Out.println(“hello!”);

}

}

a)            
編譯該檔案時會提示缺少doGet()或者dopost()方法,編譯不能夠成功通過

b)           
編譯後,把Servlet1.class放在正確位置,執行該Servlet,在瀏覽器中會看到輸出文字:hello!

c)            
編譯後,把Servlet1.class放在正確位置,執行該Servlet,在瀏覽器中看不到任何輸出的文字

d)  編譯後,把Servlet1.class放在正確位置,執行該Servlet,在瀏覽器中會看到執行期錯誤資訊

49)某web應用的上下文路徑是root,配置檔案web.xml中有如下片段:

<servlet>

<servlet-name>process</servlet-name>

<servlet-class>slt.ProcessServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>process</servlet-name>

<url-pattern>/proc</url-pattern>

</servlet-mapping>

以下說法正確的是()。(選擇二項)

a)        
在包slt中,有一個名為ProcessServlet.class的檔案

b)       
該servlet的訪問路徑是http://機器IP:埠號/root/proc

c)        
該servlet的訪問路徑是http://機器IP:埠號/root/ProcessServlet

d)       
該servlet的訪問路徑是http://機器IP:埠號/root/ProcessServlet

50) 在J2EE中,test.jsp檔案中有如下一行程式碼:

<jsp:useBean
id=”user” scope=”__” type=”com.UserBean”>

要使user物件可以作用於整個應用程式,下劃線中應添入()。(選擇一項)

a)  page                                                               b)  request

c)  session                                                             d)  application

1)在J2EE中,<%=2+4%>將輸出(6)。(選擇一項)

a) 2+4

b) 6

c) 24

d) 不會輸出,因為表示式是錯誤的

2)在J2EE中,request物件的()方法可以獲取頁面請求中一個表單元件對應多個值時的使用者的請求資料。(選擇一項)

a) String   getParameter(String
name)

b) String[] getParameter(String name)

c) String   getParameterValues(String
name)

d) String[]      getParameterValues(String
name)

3)()是傳送郵件的協議。(選擇一項)

a) SMTP

b) IAMP

c) POP3

d) HTTP

4)J2EE中,JSP
EL表示式:${user.loginName}的執行效果等同於()。(選擇一項)

a)
<%=user.getLoginName()%>

b) <% user.getLoginName();%>

c) <%=user.loginName%>

d) <% user.loginName;%>

5) 在J2EE中,test.jsp檔案中有如下一行程式碼:

<jsp:useBean
id=”user”scope=”_”type=”com.UserBean”/>

要使user物件只能在使用test.jsp時使用,當載入頁面時就會將其銷燬。下劃線中應填入()。(選擇一項)

a) page

b) request

c) session

d) application

6)要設計一個大型的基於多層體系結構的web應用系統,系統介面端基於HTML和XML,

該系統要不斷的進行版本升級(即日後維護、二次需求開發等任務量較大),要達成這些目

標,最適合的開發模式是()。(選擇一項)

a) DAO

b) ValueObject

c) MVC

d) Proxy

7) 在J2EE中,使用Servlet過濾器時,需要在web.xml通過()元素將過濾器對映到Web資源。(選擇一項)

a) <filter>

b)
<filter-mapping>

c) <servlet>

d) <servlet-mapping>

8)在J2EE的Model
II模式中,模型層物件被編寫為()。(選擇一項)

a) Applet

b) JSP

c) Servlet

d) JavaBean

9) J2EE中,()類的()方法用於返回應用程式的上下文路徑。(選擇一項)

a) HttpServletRequest、getContextPath()

b) HttpServletRequest、getPathInfo()

c) ServlettContext、getContextPath()

d) ServlettContext、getPathInfo()

10)Web應用中,常用的會話跟蹤方法不包括()。(選擇一項)

a) URL重寫

b) Cookie

c) 隱藏表單域

d) 有狀態HTTP協議

1、下面哪一個不是JSP本身已載入的基本類?(b  )

A、java.lang.*    B、java.io.*  C、javax.servlet.*  D、javax.servlet.jsp.*

2、對於預定義<%!預定義%>的說法錯誤的是:(c)

A、一次可宣告多個變數和方法,只要以“;”結尾就行   B、一個宣告僅在一個頁面中有效

C、宣告的變數將作為區域性變數         D、在預定義中宣告的變數將在JSP頁面初始化時初始化

3、從 “員工” 表的“姓名”欄位中找出名字包含“瑪麗”的人,下面哪條select語句正確:( D )

A、 Select * from員工 where 姓名 =’_瑪麗_’  B 、Select * from員工 where 姓名 =’%瑪麗_’

C、 Select * from員工 where 姓名 like ‘_瑪麗%’  D、 Select * from員工 where 姓名 like ‘%瑪麗%’

4、下述選項中不屬於JDBC基本功能的是:( D )

A.       與資料庫建立連線     B.       提交SQL語句   C.        處理查詢結果  D.       資料庫維護管理

5、在JSP中使用<jsp:getProperty>標記時,不會出現的屬性是:( c )

A.       name     B.       property     C.        value        D.       以上皆不會出現

6、Page指令用於定義JSP檔案中的全域性屬性,下列關於該指令用法的描述不正確的是:(D  )

A.    <%@ page %>作用於整個JSP頁面。

B.   可以在一個頁面中使用多個<%@ page %>指令。

C.    為增強程式的可讀性,建議將<%@ page %>指令放在JSP檔案的開頭,但不是必須的。

D.       <%@ page %>指令中的屬性只能出現一次。

7、在JSP中呼叫JavaBean時不會用到的標記是:( A )

A.       <javabean>    B.       <jsp:useBean>      C.        <jsp:setProperty>       D.       <jsp:getProperty>

8、關於JavaBean正確的說法是:(  A)

A、Java檔案與Bean所定義的類名可以不同,但一定要注意區分字母的大小寫

B、在JSP檔案中引用Bean,其實就是用<jsp:useBean>語句

C、被引用的Bean檔案的檔名字尾為.java

D、Bean檔案放在任何目錄下都可以被引用

9、Servlet程式的入口點是:(A  )

A、init()  B、main()  C、service()  D、doGet()

10、            不能在不同使用者之間共享資料的方法是(A  )

A、通過cookie  B、利用檔案系統   C、利用資料庫     D、通過ServletContext物件

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}