网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

Given an HttpServletRequest request: 22.String id = request.getParameter("jsessionid"); 23.// insert code here 24.String name = (String) session.getAttribute("name"); Which three can be placed at line 23 to retrieve anexisting HttpSession object?()

  • A、HttpSession session = request.getSession();
  • B、HttpSession session = request.getSession(id);
  • C、HttpSession session = request.getSession(true);
  • D、HttpSession session = request.getSession(false);
  • E、HttpSession session = request.getSession("jsessionid");

参考答案

更多 “ Given an HttpServletRequest request: 22.String id = request.getParameter("jsessionid"); 23.// insert code here 24.String name = (String) session.getAttribute("name"); Which three can be placed at line 23 to retrieve anexisting HttpSession object?()A、HttpSession session = request.getSession();B、HttpSession session = request.getSession(id);C、HttpSession session = request.getSession(true);D、HttpSession session = request.getSession(false);E、HttpSession session = request.getSession("jsessionid");” 相关考题
考题 在jsp页面声明中定义了一个方法,下列( )代码不能放入该方法中public void test(HttpServletReqeust request){}A、HttpSession session =request.getSession();B、String name=(String)request.getAttribute("name");C、String name=(String)session.getAttibute("name");D、request.sendRedirect(“index.jsp”);

考题 GivenanHttpServletRequestrequest:22.Stringid=request.getParameter(jsessionid);23.//insertcodehere24.Stringname=(String)session.getAttribute(name);Whichthreecanbeplacedatline23toretrieveanexistingHttpSessionobject?()A.HttpSessionsession=request.getSession();B.HttpSessionsession=request.getSession(id);C.HttpSessionsession=request.getSession(true);D.HttpSessionsession=request.getSession(false);E.HttpSessionsession=request.getSession(jsessionid);

考题 Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()A、Object o = pageContext.getAttribute("foo");B、Object o = pageContext.findAttribute("foo");C、Object o = pageContext.getAttribute("foo",PageContext.SESSION_SCOPE);D、HttpSession s = pageContext.getSession();Object o = s.getAttribute("foo");

考题 Given: 11.% 12.request.setAttribute("vals", new String[]{"1","2","3","4"}); 13.request.setAttribute("index", "2"); 14.% 15.%-- insert code here --% Which three EL expressions, inserted at line 15,are valid and evaluate to "3"?()A、${vals.2}B、${vals["2"]}C、${vals.index}D、${vals[index]}E、${vals}[index]F、${vals[vals[index-1]]}

考题 Given an HttpServletRequest request and an HttpServletResponse response: 41.HttpSession session = null; 42.// insert code here 43.if(session == null) { 44.// do something if session does not exist 45.} else { 46.// do something if session exists47. } To implement the design intent,which statement must be inserted at line 42?()A、session = response.getSession();B、session = request.getSession();C、session = request.getSession(true);D、session = request.getSession(false);E、session = request.getSession("jsessionid");

考题 1. public class Employee {  2. String name;  3. double baseSalary;  4. Employee(String name, double baseSalary) {  5. this.name = name;  6. this.baseSalary = baseSalary;  7. }  8. }  And:  1. public class Salesperson extends Employee { 2. double commission;  3. public Salesperson(String name, double baseSalary,  4. double commission) {  5. // insert code here  6. } 7. }  Which code, inserted at line 7, completes the Salesperson constructor?() A、 this.commission = commission;B、 superb(); commission = commission;C、 this.commission = commission; superb();D、 super(name, baseSalary); this.commission = commission;E、 super(); this.commission = commission;F、 this.commission = commission; super(name, baseSalary);

考题 Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()A、String s = c.readLine();B、char[ ] c = c.readLine();C、String s = c.readConsole();D、char[ ] c = c.readConsole();E、String s = c.readLine("%s", "name ");F、char[ ] c = c.readLine("%s", "name ");

考题 Given the uncompleted code of a class:     class Person {  String name, department;     int age;  public Person(String n){  name = n; }  public Person(String n, int a){  name = n;  age = a;  }  public Person(String n, String d, int a) {  // doing the same as two arguments version of constructor     // including assignment name=n,age=a    department = d;     }     }  Which expression can be added at the "doing the same as..." part of the constructor?() A、 Person(n,a);B、 this(Person(n,a));C、 this(n,a);D、 this(name,age);

考题 Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here26. } Which should you insert at line 25 to properly invoke the next filter in the chain,or the target servlet if thereare no more filters?()A、chain.forward(request, response);B、chain.doFilter(request, response);C、request.forward(request, response);D、request.doFilter(request, response);

考题 Given: 10.public void service(ServletRequest request, 11.ServletResponse response) { 12.ServletInputStream sis = 13.// insert code here 14.} Which retrieves the binary input stream on line 13?()A、request.getWriter();B、request.getReader();C、request.getInputStream();D、request.getResourceAsStream();

考题 Given the following code:     1) class Parent {     2) private String name;     3) public Parent(){}     4) }  5) public class Child extends Parent {     6) private String department;  7) public Child() {}  8) public String getValue(){ return name; }     9) public static void main(String arg[]) {     10) Parent p = new Parent();     11) }  12) }  Which line will cause error?()   A、 line 3B、 line 6C、 line 7D、 line 8E、 line 10

考题 Given the JSP code: % request.setAttribute("foo", "bar"); %and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()A、String x = (String) pageContext.getAttribute("foo")B、String x = (String) pageContext.getRequestScope("foo")C、It is NOT possible to access the pageContext object from within doStartTagD、String x = (String) pageContext.getRequest().getAttribute("foo")E、String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)

考题 Which HttpSession method stores an object in a session?()A、 put(String name. Object value)B、 set(String name. Object value)C、 setAttribute(String name. Object value)D、 putAttribute(String name. Object value)E、 addAttribute(String name. Object value)

考题 Given that session is a valid HttpSession object:   Int max = session.getAttribute(“MyReallyLongName”);   Which is true?()  A、 The value returned needs to be cast to an int.B、 The getAttribute methos takes two arguments.C、 Primitive CANNOT be stored in the HttpSession.D、 The HttpSession attribute name must NOT exceed eight characters.

考题 Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? ()A、INSERT INTO employees VALUES (NULL, 'JOHN','Smith');B、INSERT INTO employees( first_name, last_name) VALUES ('JOHN','Smith');C、INSERT INTO employees VALUES ('1000','JOHN','NULL');D、INSERT INTO employees(first_name,last_name, employee_id) VALUES ('1000, 'john','Smith');E、INSERT INTO employees (employee_id) VALUES (1000);F、INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, 'john',");

考题 Which three statements inserts a row into the table?()A、INSERT INTO employees VALUES ( NULL, ‘John’,‘Smith’);B、INSERT INTO employees( first_name, last_name) VALUES(‘John’,‘Smith’);C、INSERT INTO employees VALUES (‘1000’,‘John’,NULL);D、INSERT INTO employees(first_name,last_name, employee_id) VALUES ( 1000, ‘John’,‘Smith’);E、INSERT INTO employees (employee_id) VALUES (1000);F、INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, ‘John’,‘’);

考题 Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements insert a row into the table? ()A、INSERT INTO employees VALUES (NULL, 'John', 'smith');B、INSERT INTO employees (first_name, last_name) VALUES ('John', 'smith');C、INSERT INTO employees VALUES ('1000, 'John', 'smith');D、INSERT INTO employees (first_name, last_name, employee_id) VALUES (1000, 'John', 'smith');E、INSERT INTO employees (employee_id) VALUES (1000);F、INSERT INTO employees ( employee_id, first_name, last_name, ) VALUES (1000, 'John','');

考题 Given that c is a reference to a valid java.io.Console object,which two code fragments read a line of textfrom the console?()A、String s = c.readLine();B、char[] c = c.readLine();C、String s = c.readConsole();D、char[] c = c.readConsole();E、String s = c.readLine("%s", "name ");

考题 Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()A、 public void foo() { /* more code here */ }B、 private void foo() { /* more code here */ }C、 protected void foo() { /* more code here */ }D、 int foo() { /* more code here */ }  E、 void foo() { /* more code here */ }

考题 Given 11.public interface Status { 12./* insert code here */ int MY_VALUE = 10; 13.} Which three are valid on line 12?()A、finalB、staticC、nativeD、publicE、private

考题 单选题Given that session is a valid HttpSession object:   Int max = session.getAttribute(“MyReallyLongName”);   Which is true?()A  The value returned needs to be cast to an int.B  The getAttribute methos takes two arguments.C  Primitive CANNOT be stored in the HttpSession.D  The HttpSession attribute name must NOT exceed eight characters.

考题 单选题Given the following code:     1) class Parent {     2) private String name;     3) public Parent(){}     4) }  5) public class Child extends Parent {     6) private String department;  7) public Child() {}  8) public String getValue(){ return name; }     9) public static void main(String arg[]) {     10) Parent p = new Parent();     11) }  12) }  Which line will cause error?()A  line 3B  line 6C  line 7D  line 8E  line 10

考题 多选题Given 11.public interface Status { 12./* insert code here */ int MY_VALUE = 10; 13.} Which three are valid on line 12?()AfinalBstaticCnativeDpublicEprivate

考题 单选题Which HttpSession method stores an object in a session?()A  put(String name. Object value)B  set(String name. Object value)C  setAttribute(String name. Object value)D  putAttribute(String name. Object value)E  addAttribute(String name. Object value)

考题 多选题Given an HttpServletRequest request: 22.String id = request.getParameter("jsessionid"); 23.// insert code here 24.String name = (String) session.getAttribute("name"); Which three can be placed at line 23 to retrieve anexisting HttpSession object?()AHttpSession session = request.getSession();BHttpSession session = request.getSession(id);CHttpSession session = request.getSession(true);DHttpSession session = request.getSession(false);EHttpSession session = request.getSession(jsessionid);

考题 多选题Given an HttpServletRequest request: 22.String id = request.getParameter("jsessionid"); 23.// insert code here 24.String name = (String) session.getAttribute("name"); Which three can be placed at line 23 to retrieve anexisting HttpSession object?()AHttpSession session = request.getSession();BHttpSession session = request.getSession(id);CHttpSession session = request.getSession(true);DHttpSession session = request.getSession(false);EHttpSession session = request.getSession(jsessionid);

考题 单选题Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here 26.} Which should you insert at line 25 to properly invoke the next filter in the chain, or the target servlet if thereare no more filters?()A chain.forward(request, response);B chain.doFilter(request, response);C request.forward(request, response);D request.doFilter(request, response);