单选题Given this fragment in a servlet: 23.if(req.isUserInRole("Admin")) { 24.// do stuff 25.} And the following fragment from the related Java EE deployment descriptor: 812. 813.Admin 814.Administrator 815. 900. 901.Admin 902.Administrator 903. What is the result?()ALine 24 can never be reached.BThe deployment descriptor is NOT valid.CIf line 24 executes, the user’s role will be Admin.DIf line 24 executes, the user’s role will be Administrator.EIf line 24 executes the user’s role will NOT be predictable.

单选题
Given this fragment in a servlet: 23.if(req.isUserInRole("Admin")) { 24.// do stuff 25.} And the following fragment from the related Java EE deployment descriptor: 812. 813.Admin 814.Administrator 815. 900. 901.Admin 902.Administrator 903. What is the result?()
A

Line 24 can never be reached.

B

The deployment descriptor is NOT valid.

C

If line 24 executes, the user’s role will be Admin.

D

If line 24 executes, the user’s role will be Administrator.

E

If line 24 executes the user’s role will NOT be predictable.


参考解析

解析: 暂无解析

相关考题:

下面关于Fragment的描述,正确的是()。 A.使用Fragment,能使程序更加合理和充分地利用屏幕的空间B.Android4.0版本开始提供Fragment类C.Fragment可以代替Activity使用D.Fragment不能嵌入到Activity中

关于GetPodAction定义,下面赋值正确的是()type Fragment interface {Exec(transInfo *TransInfo) error}type GetPodAction struct {}func (g GetPodAction) Exec(transInfo *TransInfo) error {...return nil} A. var fragment Fragment = new(GetPodAction)B. var fragment Fragment = GetPodActionC. var fragment Fragment = &GetPodAction{}D. var fragment Fragment = GetPodAction{}

WhichtwoclassesorinterfacesprovideagetSessionmethod?() A.javax.servlet.http.HttpServletRequestB.javax.servlet.http.HttpSessionContextC.javax.servlet.http.HttpsServletResponseD.javax.servlet.http.HttpSessionBindingEventE.javax.servlet.http.HttpSessionAttributeEvent

Given:11.servlet12.servlet-namecatalog/servlet-name13.jsp-file/catalogTemplate.jsp/jsp-file14.load-on-startup10/load-on-startup15./servletWhichtwoaretrue?()A.Line13isnotvalidforaservletdeclaration.B.Line14isnotvalidforaservletdeclaration.C.Oneinstanceoftheservletwillbeloadedatstartup.D.Teninstancesoftheservletwillbeloadedatstartup.E.Theservletwillbereferencedbythenamecataloginmappings.

Giventhisfragmentinaservlet:23.if(req.isUserInRole(Admin)){24.//dostuff25.}AndthefollowingfragmentfromtherelatedJavaEEdeploymentdescriptor:812.security-role-ref813.role-nameAdmin/role-name814.role-linkAdministrator/role-link815./security-role-ref900.security-role901.role-nameAdmin/role-name902.role-nameAdministrator/role-name903./security-roleWhatistheresult?()A.Line24canneverbereached.B.ThedeploymentdescriptorisNOTvalid.C.Ifline24executes,theuser’srolewillbeAdmin.D.Ifline24executes,theuser’srolewillbeAdministrator.E.Ifline24executestheuser’srolewillNOTbepredictable.

Given:Which code fragment, inserted at line 23, allows the code to compile?() A.df = new DateFormat();B.df = Date.getFormat();C.df = date.getFormat();D.df = DateFormat.getFormat();E.df = DateFormat.getInstance();

Given:WhatistheresultofcallingsearchwithavalidListimplementation?() A.0B.Theresultisundefined.C.aD.2E.1F.cG.b

Which two prevent a servlet from handling requests.?()A、 The servlet’s init method returns a non-zero status.B、 The servlet’s init method throws a Servlet ExceptionC、 The servlet’s init method sets the Servlet Response’s context length to 0D、 The servlet’s init method sets the Servlet Response’s content type to null.E、 The servlet’s init method does NOT return within a time period defined by the servlet container.

Given this fragment in a servlet: 23.if(req.isUserInRole("Admin")) { 24.// do stuff 25.} And the following fragment from the related Java EE deployment descriptor: 812. 813.Admin 814.Administrator 815. 900. 901.Admin 902.Administrator 903. What is the result?()A、Line 24 can never be reached.B、The deployment descriptor is NOT valid.C、If line 24 executes, the user’s role will be Admin.D、If line 24 executes, the user’s role will be Administrator.E、If line 24 executes the user’s role will NOT be predictable.

Klenow 片段(Klenow fragment)

Given this fragment from a Java EE deployment descriptor: 341. 342.java.lang.Throwable  343./mainError.jsp 344. 345. 346.java.lang.ClassCastException  347./castError.jsp 348. If the web application associated with the fragment above throws a ClassCastException.Which statement is true?()A、The deployment descriptor is invalid.B、The container invokes mainError.jsp.C、The container invokes castError.jsp.D、Neither mainError.jsp nor castError.jsp is invoked.

Given this fragment from a Java EE deployment descriptor: 124. beta.html 125. alpha.html And this request from a browser:http://www.sun.com/SCWCDtestApp/register Which statement is correct,when the container receives this request?()A、This deployment descriptor is NOT valid.B、The container first looks in the register directory for beta.html.C、The container first looks in the register directory for alpha.html.D、The container first looks for a servlet mapping in the deployment descriptor.

Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?()   CODE FRAGMENT a:   public static void main(String args[]) {   if (args.length != 0)   System.out.println(args[args.length-1]);   }   CODE FRAGMENT b:   public static void main(String args[]) {   try { System.out.println(args[args.length]); }   catch (ArrayIndexOutOfBoundsException e) {}   }   CODE FRAGMENT c:   public static void main(String args[]) {   int ix = args.length;   String last = args[ix];   if (ix != 0) System.out.println(last);   }   CODE FRAGMENT d:   public static void main(String args[]) {   int ix = args.length-1;   if (ix  0) System.out.println(args[ix]);   }   CODE FRAGMENT e:   public static void main(String args[]) {   try { System.out.println(args[args.length-1]);  }catch (NullPointerException e) {}   }  A、Code fragment a.B、Code fragment b.C、Code fragment c.D、Code fragment d.E、Code fragment e.

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

单选题Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?()   CODE FRAGMENT a:   public static void main(String args[]) {   if (args.length != 0)   System.out.println(args[args.length-1]);   }   CODE FRAGMENT b:   public static void main(String args[]) {   try { System.out.println(args[args.length]); }   catch (ArrayIndexOutOfBoundsException e) {}   }   CODE FRAGMENT c:   public static void main(String args[]) {   int ix = args.length;   String last = args[ix];   if (ix != 0) System.out.println(last);   }   CODE FRAGMENT d:   public static void main(String args[]) {   int ix = args.length-1;   if (ix  0) System.out.println(args[ix]);   }   CODE FRAGMENT e:   public static void main(String args[]) {   try { System.out.println(args[args.length-1]);  }catch (NullPointerException e) {}   }ACode fragment a.BCode fragment b.CCode fragment c.DCode fragment d.ECode fragment e.

单选题Given an Http Session session. A Servlet Request request. And a Servlet Context context. Which retrieves a URL to /WEB INF/ my config.xml within a web application?()A session.get Resource (“/WEB-INF/myconfig.xml”)B request.get Resource (“/WEB-INF/myconfig.xml”)C context.get Resource (“/WEB-INF/myconfig.xml”)D get Class ().get Resource (“/WEB-INF/myconfig.xml”)

多选题Given: 11. 12.catalog 13./catalogTemplate.jsp 14.10 15. Which two are true?()ALine 13 is not valid for a servlet declaration.BLine 14 is not valid for a servlet declaration.COne instance of the servlet will be loaded at startup.DTen instances of the servlet will be loaded at startup.EThe servlet will be referenced by the name catalog in mappings.

多选题Given: 11. 12.catalog 13./catalogTemplate.jsp 14.10 15. Which two are true?()ALine 13 is not valid for a servlet declaration.BLine 14 is not valid for a servlet declaration.COne instance of the servlet will be loaded at startup.DTen instances of the servlet will be loaded at startup.EThe servlet will be referenced by the name catalog in mappings.

单选题Given this fragment from a Java EE deployment descriptor: 124. beta.html 125. alpha.html And this request from a browser:http://www.sun.com/SCWCDtestApp/register Which statement is correct,when the container receives this request?()AThis deployment descriptor is NOT valid.BThe container first looks in the register directory for beta.html.CThe container first looks in the register directory for alpha.html.DThe container first looks for a servlet mapping in the deployment descriptor.

多选题在J2EE中,对于自己编写的Servlet1,以下对Servlet1的定义正确的是()。Aclass Servlet1 implements javax.servlet.ServletBclass Servlet1 extends javax.servlet.GenericServletCclass Servlet1 extends javax.servlet.http.HttpServletDclass Servlet1 extends javax.servlet.ServletRequest

多选题Which code fragments will succeed in initializing a two-dimensional array named tab with a size that will cause the expression tab[3][2] to access a valid element?()   CODE FRAGMENT a:  int[][] tab = {  { 0, 0, 0 },  { 0, 0, 0 }  };   CODE FRAGMENT b:  int tab[][] = new int[4][];  for (int i=0; i   CODE FRAGMENT c:  int tab[][] = {  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0  };   CODE FRAGMENT d:  int tab[3][2];   CODE FRAGMENT e:  int[] tab[] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };ACode fragment a.BCode fragment b.CCode fragment c.DCode fragment d.ECode fragment e.

多选题For a given Servlet Response response, which retrieves an object for writing binary data? ()Aresponse.get writer ()Bresponse.get Output Stream ()Cresponse.getOutput Writer()Dresponse.get Writer ().get Output Stream ()Eresponse.get Writer (Writer.OUTPUT_BINARY)

单选题Given this fragment in a servlet: 23.if(req.isUserInRole("Admin")) { 24.// do stuff 25.} And the following fragment from the related Java EE deployment descriptor: 812. 813.Admin 814.Administrator 815. 900. 901.Admin 902.Administrator 903. What is the result?()ALine 24 can never be reached.BThe deployment descriptor is NOT valid.CIf line 24 executes, the user’s role will be Admin.DIf line 24 executes, the user’s role will be Administrator.EIf line 24 executes the user’s role will NOT be predictable.

多选题For a given Servlet Response response, which two retrieve an object for writing text data? ()Aresponse.get Writer ()Bresponse.get Output Stream ()Cresponse.get Output Writer ()Dresponse.get Writer ().get Output Stream()Eresponse.get Writer (Writer.OUTPUT_TEXT)

单选题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 this fragment from a Java EE deployment descriptor: 341. 342.java.lang.Throwable  343./mainError.jsp 344. 345. 346.java.lang.ClassCastException  347./castError.jsp 348. If the web application associated with the fragment above throws a ClassCastException.Which statement is true?()AThe deployment descriptor is invalid.BThe container invokes mainError.jsp.CThe container invokes castError.jsp.DNeither mainError.jsp nor castError.jsp is invoked.

单选题Given this fragment from a Java EE deployment descriptor: 341. 342.java.lang.Throwable  343./mainError.jsp 344. 345. 346.java.lang.ClassCastException  347./castError.jsp 348. If the web application associated with the fragment above throws a ClassCastException.Which statement is true?()AThe deployment descriptor is invalid.BThe container invokes mainError.jsp.CThe container invokes castError.jsp.DNeither mainError.jsp nor castError.jsp is invoked.