网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
下列定义Session变量的语句中,正确的是()。
- A、<% Session(” name ”)= Tom %>
- B、<% Session(name )= ” Tom ” %>
- C、<%Session(name )= Tom %>
- D、<% Session(” name ”)= ” Tom ” %>
参考答案
更多 “下列定义Session变量的语句中,正确的是()。A、% Session(” name ”)= Tom %B、% Session(name )= ” Tom ” % C、%Session(name )= Tom % D、% Session(” name ”)= ” Tom ” % ” 相关考题
考题
本题中定义了一个带有参数的构造方法javal,并定义了一个该类的对象temp。构造方法javal有两个参数:字符串name和整型age。定义对象temp时将字符串“Tom"和整数17传递给构造方法,构造方法将这两个参数打印输出。 public class javal{ String name; int age; public static void main(String[]args){ String name="Tom"; int age=17; javal temp = ; } public javal(String name, ){ ; this.age= age; System.out.println(name+"is"+age+" years old."); } }
考题
在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”);
考题
Adeveloperwantstomakeanameattributeavailabletoallservletsassociatedwithaparticularuser,acrossmultiplerequestsfromthatuser,fromthesamebrowserinstance.Whichtwoprovidethiscapability fromwithinataghandler?()A.pageContext.setAttribute(name,theValue)B.pageContext.setAttribute(name,getSession())C.pageContext.getRequest().setAttribute(name,theValue)D.pageContext.getSession().setAttribute(name,theValue)E.pageContext.setAttribute(name,theValue,PageContext.PAGE_SCOPE)F.pageContext.setAttribute(name,theValue,PageContext.SESSION_SCOPE)
考题
类Teacher:classTeacher{Stringname;floatsalary;Teacher(Stringname){this.name=name;}Teacher(Stringname,floatsalary){this.name=name;this.salary=salary;}}执行语句Teachert=newTeacher(Tom”,2000.0f);后,字段salary的值是哪一项?()A.2000.0fB.0.0fC.null;D.2000
考题
假设现在已经利用session对象把变量a赋值为hello,那么下列语句中能显示出“hello”的是______。A.<%=session("a")%>B.<%=session"a"%>C.<%=session(a)%>D.<%=session: a%>
考题
已知wage.getItem().size()的值是1。要想使执行session.update(wage)时自动执行session.update(wage.getItems().get(0)),必须配置()A、<set name=”items” inverse=”true” cascade=”none”>…</set>B、<set name=”items” inverse=”false” cascade=”none”>…</set>C、<set name=”items” inverse=”true” cascade=”all”>…</set>D、<set name=”items” inverse=”false” cascade=”save-update”>…</set>
考题
如果要把一个用户名jack保存在session对象里,则下列语句正确的是()。A、 session.setAttribute( name, jack );B、 session.setAttribute(“ name” , “jack”);C、 session.setAttribute( “jack”, “ name” );D、 session.setAttribute(“jack”, name );
考题
请问下面程序段执行完毕,页面上显示的内容是什么()%DimstrTempstrTemp="user_name"Session("strTemp")="张红"Session(strTemp)="王刚"Response.WriteSession("user_name")%A、张红B、王刚C、张红王刚D、语法有错,无法正常输出
考题
类Teacher: class Teacher{ String name; float salary; Teacher(String name){ this.name = name; } Teacher(String name,float salary){ this.name = name; this.salary = salary; } } 执行语句Teacher t = new Teacher(“Tom”,2000.0f);后,字段salary的值是哪一项?() A、 2000.0fB、 0.0fC、 null;D、 2000
考题
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");
考题
类Student的声明如下: package com.school class Student{ String name; int age; Student(String name,int age){ //code } void study(String subject){ / /code } } 正确调用方法study(String subject)的是哪项?() A、Student stu = new Student(“Tom”,23); stu.study(“数学”);B、Student.study(“数学”);C、Student stu = new Student(“Tom”,23); stu.study();D、Student stu = new Student(“Tom”,23); String result=stu.study(“数学”);
考题
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.
考题
单选题如果要把一个用户名jack保存在session对象里,则下列语句正确的是()。A
session.setAttribute( name, jack );B
session.setAttribute(“ name” , “jack”);C
session.setAttribute( “jack”, “ name” );D
session.setAttribute(“jack”, name );
考题
单选题类Teacher: class Teacher{ String name; float salary; Teacher(String name){ this.name = name; } Teacher(String name,float salary){ this.name = name; this.salary = salary; } } 执行语句Teacher t = new Teacher(“Tom”,2000.0f);后,字段salary的值是哪一项?()A
2000.0fB
0.0fC
null;D
2000
考题
单选题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.
考题
单选题已知wage.getItem().size()的值是1。要想使执行session.update(wage)时自动执行session.update(wage.getItems().get(0)),必须配置()A
<set name=”items” inverse=”true” cascade=”none”>…</set>B
<set name=”items” inverse=”false” cascade=”none”>…</set>C
<set name=”items” inverse=”true” cascade=”all”>…</set>D
<set name=”items” inverse=”false” cascade=”save-update”>…</set>
考题
单选题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);
考题
单选题—Whose notebook is this?—It ______ be Tom’s. It has his name on it.A
mustB
mayC
mightD
can’t
考题
单选题VRRP与BFD进行联动的配置命令是()A
Vrrp vrid 1 track bfd-session session-name 1 reduced 100B
bfd-session Vrrp vrid 1 track session-name 1 reduced 100C
track vrrp vrid 1 bfd-session session-name 1 reduced 100D
Vrrp vrid 1 track bfd-session-name 1 reduced 100
考题
单选题类Student的声明如下: package com.school class Student{ String name; int age; Student(String name,int age){ //code } void study(String subject){ / /code } } 正确调用方法study(String subject)的是哪项?()A
Student stu = new Student(“Tom”,23); stu.study(“数学”);B
Student.study(“数学”);C
Student stu = new Student(“Tom”,23); stu.study();D
Student stu = new Student(“Tom”,23); String result=stu.study(“数学”);
热门标签
最新试卷