单选题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 t

题目
单选题
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.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Which two are true?()

A.A finalizer may NOT be invoked explicitly.

B.The finalize method declared in class Object takes no action.

C.super.finalize()is called implicitly by any over riding finalize method.

D.The finalize method for a given objec twill be called no more than once by the garbage collector.

E.The order in which finalize will be called on two objects is based on the order in which the two objects became finalizable.


参考答案:B, D

第2题:

下列操作Session时,代码错误的是()

  • A、HttpSession session=request.getSession(true);
  • B、Session session=new Session();
  • C、session.setAttribute("username","admin");
  • D、String username=(String)session.getAttribute("username");
  • E、response.add Session(Session);

正确答案:B,E

第3题:

要在session对象中保存属性,可以使用session.getAttribute("key","value")语句。()

此题为判断题(对,错)。


参考答案:错误

第4题:

You need to store a floating point number,called Tsquare,in the session scope. Which two code snippetsallow you to retrieve this value?()

  • A、float Tsquare = session.getFloatAttribute("Tsquare");
  • B、float Tsquare = (Float) session.getAttribute("Tsquare");
  • C、float Tsquare = (float) session.getNumericAttribute("Tsquare");
  • D、float Tsquare = ((Float) session.getAttribute.("Tsquare")).floatValue();
  • E、float Tsquare = ((Float) session.getFloatAttribute.("Tsquare")).floatValue;

正确答案:B,D

第5题:

Given: 6. 7.<%="processing" %> 8. and a custom tag handler for foo which extends TagSupport. Which two are true about thetag handler referenced by foo?()

  • A、The doStartTag method is called once.
  • B、The doAfterBody method is NOT called.
  • C、The EVAL_PAGE constant is a valid return value for the doEndTag method.
  • D、The SKIP_PAGE constant is a valid return value for the doStartTag method.
  • E、The EVAL_BODY_BUFFERED constant is a valid return value for the doStartTag method.

正确答案:A,C

第6题:

以下()可用于检索session属性userid的值。

  • A、session.getAttribute(“userid”)
  • B、session.setAttribute(“userid”)
  • C、request.getParameter(“userid”)
  • D、request.getAttribute(“userid”)

正确答案:A

第7题:

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");

正确答案:B,C,D

第8题:

GiventhatsessionisavalidHttpSessionobject:Intmax=session.getAttribute(MyReallyLongName”);Whichistrue?()

A.Thevaluereturnedneedstobecasttoanint.

B.ThegetAttributemethostakestwoarguments.

C.PrimitiveCANNOTbestoredintheHttpSession.

D.TheHttpSessionattributenamemustNOTexceedeightcharacters.


参考答案:C

第9题:

Given: 6.<% int[] nums = {42, 420, 4200}; 7.request.setAttribute("foo", nums); %> Which two successfully translate and result in a value of true?()

  • A、${true or false}
  • B、${requestScope[foo][0] > 500}
  • C、${requestScope[’foo’][1] = 420}
  • D、${(requestScope[’foo’][0] lt 50) && (3 gt 2)}

正确答案:A,D

第10题:

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");

正确答案:A,C,D

更多相关问题