An IllegalStateException is thrown at runtime.
An InvalidSessionException is thrown at runtime.
The string value=null appears in the response stream.
The string value=myAttributeValue appears in the response stream.
第1题:
在J2EE中,有如下代码在Servlet1.Java中 Import javax.servlet.*; Import javax.servlet.http.* Import java.io.IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init () throw ServletException {} Public void service(HttpServletRequest request, HttpServletResponce response) throws ServletException,IOException{ PrintWriter out=response.getWriter(); Out.println(“hello!”); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下成熟正确的是()
第2题:
在J2EE中,Servlet1的代码如下: import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class Servlet1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String aa=request.getQueryString(); String bb=request.getMethod(); out.println(aa); out.println(bb); } } 把Servlet1.class文件放在Web服务器适合的目录下,在浏览B器地址栏内输入:http://localhost:8080/servlet/Servlet1?name=jb-aptech&phone=12345678,看到的结果是()。
第3题:
Given the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()
第4题:
在Servlet里,能正确获取session的语句是()。
第5题:
Given: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.// insert code here 16.} 17.} and this element in the web application’s deployment descriptor:
第6题:
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?()
第7题:
Which retrieves all cookies sent in a given HttpSErvletRequest request?()
第8题:
name=jb-aptech&phone=12345678 GET
name=jb-aptech,phone=12345678 GET
jb-aptech,12345678 POST
name,phone GET
2,POST
第9题:
session = response.getSession();
session = request.getSession();
session = request.getSession(true);
session = request.getSession(false);
session = request.getSession(jsessionid);
第10题:
request.getCookies()
request.getAttributes()
request.getSession ().getCookies()
request.getSession (). GetAttributes()
第11题:
编译该晚间时会提示缺少doGe()t或者doPost(),编译不能够成功通过
编译后,把Serlvet.cass放在正确的位置,在浏览器中查看该Servlet1,会看到输出文在:“hello!”
编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看不到任何输出的文字
编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息
第12题:
chain.forward(request, response);
chain.doFilter(request, response);
request.forward(request, response);
request.doFilter(request, response);
第13题:
在J2EE中,有如下代码在Servlet1.java中。 import javax.servlet.*; import javax.servlet.http.*; import java.io.IOException; import java.io.PrintWriter; 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!"); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下陈述正确的是()。
第14题:
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?()
第15题:
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?()
第16题:
在J2EE中,有如下代码在Servlet1.java中 Import javax.servlet.*; Import javax,servlet.http.*; Import java.io,IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init() throws ServletException{} Public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException{ PrintWriter out = reponse.getWriter(); Out.println("hello!"); } } 假如要编 译的环境已都已经搭建好。现在用完全正确的命令编译该文件,对于以下陈述正确的是();
第17题:
Given the following interface definition, which definitions are valid?() interface I { void setValue(int val); int getValue(); } DEFINITION a: (a) class a extends I { int value; void setValue(int val) { value = val; } int getValue() { return value; } } DEFINITION b: (b) interface b extends I { void increment(); } DEFINITION c: (c) abstract class c implements I { int getValue() { return 0; } abstract void increment(); } DEFINITION d: (d) interface d implements I { void increment(); } DEFINITION e: (e) class e implements I { int value; public void setValue(int val) { value = val; } }
第18题:
Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only
第19题:
HttpSession session=request.getSession(true)
HttpSession session=request.getHttpSession(true)
HttpSession session=response.getSession(true)
HttpSession session=response.getHttpSession(true)
第20题:
An IllegalStateException is thrown at runtime.
An InvalidSessionException is thrown at runtime.
The string value=null appears in the response stream.
The string value=myAttributeValue appears in the response stream.
第21题:
HttpSession session = request.getSession();
HttpSession session = request.getSession(id);
HttpSession session = request.getSession(true);
HttpSession session = request.getSession(false);
HttpSession session = request.getSession(jsessionid);
第22题:
编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,会看到输出文字:“hello!”
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看不到任何输出的文字
编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息
第23题:
编译文件时会提醒缺少doGet和doPost方法,编译不能成功通过
编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会看到输出文字:“hello”
编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet却看不到任何文字
编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会却看到运行时的错误信息
第24题:
response.setError(302);
response.sendError(302);
response.setStatus(302);
response.sendRedirect(302);
response.sendErrorRedirect(302);