问题:单选题You are building JSP pages that have a set of menus that are visible based on a user’s security role. Thesemenus are hand-crafted by your web design team; for example, the SalesManager role has a menu in thefile /WEB-INF/html/sales-mgr-menu.html. Which JSP code snippet should be used to make this menuvisible to the user?()A <% if ( request.isUserInRole(SalesManager) ) { %> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> <% } %>B <jsp:if test=’request.isUserInRole(SalesManager)’> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> </jsp:if>C <% if ( request.isUserInRole(SalesManager) ) { %> . <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> . <% } %>D <jsp:if test=’request.isUserInRole(SalesManager)’> <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> </jsp:if>
Sunday, March 26, 2023
问题:多选题Which three are true about servlet filters?()AA filter must implement the destroy method.BA filter must implement the doFilter method.CA servlet may have multiple filters associated with it.DA servlet that is to have a filter applied to it must implement the javax.servlet.FilterChain interface.EA filter that is part of a filter chain passes control to the next filter in the chain by invoking the FilterChain.forward method.
Friday, September 16, 2022
问题:单选题Which element of a web application deployment descriptor element is required?()A <realm-name>B <auth-method>C <security-role>D <transport-guarantee>E <web-resource-collection>
Sunday, January 15, 2023
问题:单选题Given: 5.public class MyTagHandler extends TagSupport { 6.public int doStartTag() throws JspException { 7.try { 8.// insert code here 9.} catch(Exception ex) { /* handle exception */ } 10.return super.doStartTag(); 11.}...42. } Which code snippet, inserted at line 8,causes the value foo to be output?()A JspWriter w = pageContext.getOut();B print(foo);C JspWriter w = pageContext.getWriter();D JspWriter w = new JspWriter(pageContext.getWriter()); . w.print(foo);
Friday, July 14, 2023
问题:多选题Given a web application in which the request parameter productID contains a product identifier. Which twoEL expressions evaluate the value of the productID?()A${productID}B${param.productID}C${params.productID}D${params.productID[1]}E${paramValues.productID}F${paramValues.productID[0]}
Wednesday, December 13, 2023
问题:单选题A developer is designing the presentation tier for a web application that relies on a complex session bean.The session bean is still being developed and the APIs for it are NOT finalized. Any changes to the sessionbean API directly impacts the development of the presentation tier. Which design pattern provides a meansto manage the uncertainty in the API?()A View HelperB Front ControllerC Composite ViewD Intercepting FilterE Business Delegate
Tuesday, September 20, 2022
问题:单选题Every page of your web site must include a common set of navigation menus at the top of the page. Thismenu is static HTML and changes frequently,so you have decided to use JSP’s static import mechanism. Which JSP code snippet accomplishes this goal?()A <%@ import file=’/common/menu.html’ %>B <%@ page import=’/common/menu.html’ %>C <%@ import page=’/common/menu.html’ %>D <%@ include file=’/common/menu.html’ %>E <%@ page include=’/common/menu.html’ %>
Thursday, April 11, 2024
问题:单选题Which statement is true if the doStartTag method returns EVAL_BODY_BUFFERED?()A The tag handler must implement BodyTag.B The doAfterBody method is NOT called.C The setBodyContent method is called once.D It is never legal to return EVAL_BODY_BUFFERED from doStartTag.
Friday, April 26, 2024
问题:多选题For an HttpServletResponse response,which two create a custom header?()Aresponse.setHeader(X-MyHeader, 34);Bresponse.addHeader(X-MyHeader, 34);Cresponse.setHeader(new HttpHeader(X-MyHeader, 34));Dresponse.addHeader(new HttpHeader(X-MyHeader, 34));Eresponse.addHeader(new ServletHeader(X-MyHeader, 34));
问题:单选题A web browser need NOT always perform a complete request for a particular page that it suspects mightNOT have changed. The HTTP specification provides a mechanism for the browser to retrieve only a partialresponse from the web server; this response includes information, such as the Last-Modified date but NOTthe body of the page. Which HTTP method will the browser use to retrieve such a partial response?()A GETB ASKC SENDD HEADE TRACE
问题:单选题You have created a web application that you license to real estate brokers. The webapp is highly customizable including the email address of the broker, which is placed on the footer of each page. This isconfigured as a context parameter in the deployment descriptor: 10. 11.footerEmail 12.joe@estates-r-us.biz 13. Which EL code snippet will insert this context parameter into the footer?()A <a href=’mailto:${footerEmail}’>Contact me</a>B <a href=’mailto:${initParam@footerEmail}’>Contact me</a>C <a href=’mailto:${initParam.footerEmail}’>Contact me</a>D <a href=’mailto:${contextParam@footerEmail}’>Contact me</a>E <a href=’mailto:${contextParam.footerEmail}’>Contact me</a>
问题:单选题A JSP page contains a taglib directive whose uri attribute has the value dbtags. Which XML element withinthe web application deployment descriptor defines the associated TLD?()A <tld><uri>dbtags</uri><location>/WEB-INF/tlds/dbtags.tld</location></tld>B <taglib><uri>dbtags</uri><location>/WEB-INF/tlds/dbtags.tld</location>. </taglib>C <tld>. <tld-uri>dbtags</tld-uri>. <tld-location>/WEB-INF/tlds/dbtags.tld</tld-location> . </tld>D <taglib><taglib-uri>dbtags</taglib-uri><taglib-location>/WEB-INF/tlds/dbtags.tld. </taglib-location>. </taglib>
问题:单选题Your web application views all have the same header, which includes the tag in the elementof the rendered HTML. You have decided to remove this redundant HTML code from your JSPs and put itinto a single JSP called /WEB-INF/jsp/header.jsp. However, the title of each page is unique, so you havedecided to use a variable called pageTitle to parameterize this in the header JSP, like this: 10.${param.pageTitle} Which JSP code snippet should you use in your main view JSPs to insert the header and pass thepageTitle variable?()A <jsp:insert page=’/WEB-INF/jsp/header.jsp’>. ${pageTitle=’Welcome Page’}. </jsp:insert>B <jsp:include page=’/WEB-INF/jsp/header.jsp’>. ${pageTitle=’Welcome Page’}. </jsp:include>C <jsp:include file=’/WEB-INF/jsp/header.jsp’>. ${pageTitle=’Welcome Page’}. </jsp:include>D <jsp:insert page=’/WEB-INF/jsp/header.jsp’>. <jsp:param name=’pageTitle’ value=’Welcome Page’ /> . </jsp:insert>E <jsp:include page=’/WEB-INF/jsp/header.jsp’>. <jsp:param name=’pageTitle’ value=’Welcome Page’ /> . </jsp:include>
问题:多选题A developer wants a web application to be notified when the application is about to be shut down. Which two actions are necessary to accomplish this goal?()AInclude a listener directive in a JSP pageBconfigure a listener in the TLD file using the elementCInclude a element in the web application deployment descriptorDconfigure a listener in the application deployment descriptor, using the elementEInclude a class implementing ServletContextListener as part of the web application deploymen
Friday, February 9, 2024
问题:单选题All of your JSPs need to have a link that permits users to email the web master. This web application islicensed to many small businesses, each of which have a different email address for the web master. Youhave decided to use a context parameter that you specify in the deployment descriptor, like this: 42. 43.webmasterEmail 44.master@example.com 45. Which JSP code snippet creates this email link?()A <a href=’mailto:${contextParam.webmasterEmail}’>contact us</a>B <a href=’mailto:${applicationScope.webmasterEmail}’>contact us</a>C <a href=’mailto:${contextInitParam.webmasterEmail}’>contact us</a>D <a href=’mailto:${initParam.webmasterEmail}’>contact us</a>
问题:单选题A developer has used this code within a servlet: 62.if(request.isUserInRole("vip")) { 63.// VIP-related logic here 64.} What else must the developer do to ensure that the intended security goal is achieved?()A Create a user called vip in the security realmB Define a group within the security realm and call it vipC Define a security-role named vip in the deployment descriptorD Declare a security-role-ref for vip in the deployment descripto
问题:单选题A developer is designing a web application that must verify for each request: The originating request is froma trusted network. The client has a valid session.The client has been authenticated. Which design pattern provides a solution in this situation?()A Transfer ObjectB Session FacadeC Intercepting FilterD Template MethodE Model-View-Controller
问题:多选题Which three are described in the standard web application deployment descriptor?()Asession configurationBMIME type mappingsCcontext root for the applicationDservlet instance pool configurationEweb container default port bindingsFServlet Context initialization parameters
问题:单选题Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface: public interface ApplicationController {public String invoke(HttpServletRequest request)} The return value of this method indicates a symbolic name of the next view. From this name, the FrontController servlet looks up the JSP URL in a configuration table. This URL might be an absolute path or apath relative to the current request. Next, the Front Controller servlet must send the request to this JSP togenerate the view. Assume that the servlet variable request is assigned the current HttpServletRequestobject and the variable context is assigned the webapp’s ServletContext. Which code snippet of the FrontController servlet accomplishes this goal?()A Dispatcher view=context.getDispatcher(viewURL);view.forward Request(request, response);B Dispatcher view=request.getDispatcher(viewURL);view.forward Request(request, response);C RequestDispatcher view. =context.getRequestDispatcher(viewURL);view.forward(request,response);D RequestDispatcher view=request.getRequestDispatcher(viewURL);view.forward(request, response);
Friday, October 6, 2023
问题:多选题You are designing an n-tier Java EE application. You have already decided that some of your JSPs willneed to get data from a Customer entity bean. You are trying to decide whether to use a Customer stubobject or a Transfer Object. Which two statements are true?()AThe stub will increase network traffic.BThe Transfer Object will decrease data staleness.CThe stub will increase the logic necessary in the JSPs.DIn both cases, the JSPs can use EL expressions to get data.EOnly the Transfer Object will need to use a Business Delegate.
Friday, May 12, 2023