多选题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  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()AA user whose role is Admin can perform a PUT.BA user whose role is Admin can perform a GET.CA user whose role is Admin can perform a POST.DA user whose role is Member can perform a PUT.EA user whose role is Member can perform a POST.FA user whose role is Member can perform a GET.

多选题
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  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()
A

A user whose role is Admin can perform a PUT.

B

A user whose role is Admin can perform a GET.

C

A user whose role is Admin can perform a POST.

D

A user whose role is Member can perform a PUT.

E

A user whose role is Member can perform a POST.

F

A user whose role is Member can perform a GET.


参考解析

解析: 暂无解析

相关考题:

在J2EE中,给定某Servlet的代码如下,编译运行该文件,以下陈述正确的是( )public class Servletl extends HttpServlet{public void init() throws ServletException{}public void service(HttpServletRequestrequest,HttpServletResponse response)throwsServletException,IOException{PrintWriter ut=response.getWriter();out.println(“hello!”);}}A、编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过B、编译后,把Servletl.class放在正确位置,运行该Servlet,在浏览器中会看到输出文字:hello!C、编译后,把Servletl.class放在正确位置,运行该Servlet,在浏览器中会看不到任何输出的文字D、编译后, 把Servletl.class放在正确位置,运行该Servlet,在浏览器中会看到运行期错误信息

Servlet的基本架构public class ServletName extends HttpServlet {public void doPost(HttpServletRequest request, HttpServletResponse response) throwsServletException, IOException {}public void doGet(HttpServletRequest request, HttpServletResponse response) throwsServletException, IOException {}}1、用String的方法将数据类型转换为String。

下面哪个方法不是HttpServlet类:()A、protected void doGet(HttpServletRequest reg,HttpServletResponse res) throws Servlet Exception ,java.io.IOExceptionB、protected void doPost(HttpServletRequest reg,HttpServletResponse res) throws Servlet Exception,java.io.IOExceptionC、protected void doHead(HttpServletRequest reg,HttpServletResponse res) throws Servlet Exception,java.io.IOExceptionD、protected void doReceive(HttpServletRequest reg,HttpServletResponse res) throws ServletException,java.io.IOException

在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要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下成熟正确的是()  A、编译该晚间时会提示缺少doGe()t或者doPost(),编译不能够成功通过B、编译后,把Serlvet.cass放在正确的位置,在浏览器中查看该Servlet1,会看到输出文在:“hello!”C、编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看不到任何输出的文字D、编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息

在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要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下陈述正确的是()。 A、编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过B、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,会看到输出文字:“hello!”C、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看不到任何输出的文字D、编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息

在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-aptechphone=12345678,看到的结果是()。 A、name=jb-aptechphone=12345678 GETB、name=jb-aptech,phone=12345678 GETC、jb-aptech,12345678 POSTD、name,phone GETE、2,POST

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 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?()A、An IllegalStateException is thrown at runtime.B、An InvalidSessionException is thrown at runtime.C、The string "value=null" appears in the response stream.D、The string "value=myAttributeValue" appears in the response stream.

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

1. public class Exception Test {  2. class TestException extends Exception {}  3. public void runTest() throws TestException {}  4. public void test() /* Point X */ {  5. runTest();  6. }  7. }  At Point X on line 4, which code is necessary to make the code compile?()  A、 No code is necessary.B、 throws ExceptionC、 catch ( Exception e )D、 throws RuntimeExceptionE、 catch ( TestException e)

1. public class A {  2. public void method1() {  3. B b=new B();  4. b.method2();  5. // more code here  6. }  7. }  1. public class B {  2. public void method2() {  3.C c=new C();  4. c.method3();  5. // more code here  6. }  7. }  1. public class C {  2. public void method3() {  3. // more code here  4. }  5. }  Given:  25. try {  26. A a=new A();  27. a.method1();  28. } catch (Exception e) {  29. System.out.print(”an error occurred”);  30. }  Which two are true if a NullPointerException is thrown on line 3 of class C?()A、 The application will crash.B、 The code on line 29 will be executed.C、 The code on line 5 of class A will execute.D、 The code on line 5 of class B will execute.E、 The exception will be propagated back to line 27.

在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!"); } }  假如要编  译的环境已都已经搭建好。现在用完全正确的命令编译该文件,对于以下陈述正确的是(); A、编译文件时会提醒缺少doGet和doPost方法,编译不能成功通过B、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会看到输出文字:“hello”C、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet却看不到任何文字D、编译后,把Servlet.Class放在正确的位置,在浏览器查看该Servlet会却看到运行时的错误信息

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: 302 /html/error.html Which,inserted at line 15,causes the container to redirect control to the error.html resource?()A、response.setError(302);B、response.sendError(302);C、response.setStatus(302);D、response.sendRedirect(302);E、response.sendErrorRedirect(302);

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: 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  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()A、A user whose role is Admin can perform a PUT.B、A user whose role is Admin can perform a GET.C、A user whose role is Admin can perform a POST.D、A user whose role is Member can perform a PUT.E、A user whose role is Member can perform a POST.F、A user whose role is Member can perform a GET.

public class TestA{   public void methodA()  throws IOException{   //……   }   }   public class TestB extends TestA{   public void methodA()  throws EOFException{   //……   }   }   public class TestC extends TestA{   public void methodA()  throws Exception{   //……   }   }   当编译类TestC的时候,结果是哪项?() A、 正常B、 编译错误C、 运行错误D、 以上都不对

Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()A、 The attribute foo is placed in the applicationB、 A ServletContextListener registered for that servlet is notifiedC、 A ServletAttributeListener registered for that servlet is notifiedD、 An HttpSessionAttributeListener registered for that servlet is notified

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:   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?()Apublic void foo() { /* more code here */ }Bprivate void foo() { /* more code here */ }Cprotected void foo() { /* more code here */ }Dint foo() { /* more code here */ }Evoid foo() { /* more code here */ }

单选题1. public class Exception Test {  2. class TestException extends Exception {}  3. public void runTest() throws TestException {}  4. public void test() /* Point X */ {  5. runTest();  6. }  7. }  At Point X on line 4, which code is necessary to make the code compile?()A No code is necessary.B throws ExceptionC catch ( Exception e )D throws RuntimeExceptionE catch ( TestException e)

多选题Given: Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }

单选题Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()Aany classBonly the Target classCany class in the test packageDany class that extends Target

多选题1. public class A {  2. public void method1() {  3. B b=new B();  4. b.method2();  5. // more code here  6. }  7. }  1. public class B {  2. public void method2() {  3.C c=new C();  4. c.method3();  5. // more code here  6. }  7. }  1. public class C {  2. public void method3() {  3. // more code here  4. }  5. }  Given:  25. try {  26. A a=new A();  27. a.method1();  28. } catch (Exception e) {  29. System.out.print(”an error occurred”);  30. }  Which two are true if a NullPointerException is thrown on line 3 of class C?()AThe application will crash.BThe code on line 29 will be executed.CThe code on line 5 of class A will execute.DThe code on line 5 of class B will execute.EThe exception will be propagated back to line 27.

多选题class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }

单选题在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要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下陈述正确的是()。A编译该文件时会提示缺少doGet()或者doPost()方法,编译不能够成功通过B编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,会看到输出文字:“hello!”C编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看不到任何输出的文字D编译后,把Servlet1.class放在正确位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息

多选题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  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()AA user whose role is Admin can perform a PUT.BA user whose role is Admin can perform a GET.CA user whose role is Admin can perform a POST.DA user whose role is Member can perform a PUT.EA user whose role is Member can perform a POST.FA user whose role is Member can perform a GET.

单选题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?()Achain.forward(request, response);Bchain.doFilter(request, response);Crequest.forward(request, response);Drequest.doFilter(request, response);

多选题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?()AObject o = pageContext.getAttribute(foo);BObject o = pageContext.findAttribute(foo);CObject o = pageContext.getAttribute(foo,PageContext.SESSION_SCOPE);DHttpSession s = pageContext.getSession();Object o = s.getAttribute(foo);