Assume the custom tag my:errorProne always throws a java.lang.RuntimeException with the message "Filenot found." An error page has been configured for this JSP page.
Which option prevents the exceptionthrown by my:errorProne from invoking the error page mechanism, and outputs the message "File notfound" in the response?()
A.<c:try catch="ex"><my:errorProne /></c:try>${ex.message}
B.<c:catch var="ex"><my:errorProne /></c:catch>${ex.message}
C.<c:try>. <my:errorProne />. </c:try>. <c:catch var="ex" />. ${ex.message}
D.<c:try>. <my:errorProne />. <c:catch var="ex" />. ${ex.message}. </c:try>
您可能感興趣的試卷
你可能感興趣的試題
You are writing a JSP that includes scriptlet code to declare a List variable and initializes that variable to anArrayList object.
Which two JSP code snippets can you use to import these list types?()
A.<%! import java.util.*; %>
B.<%! import java.util.List;import java.util.ArrayList; %>
C.<%@ page import=’java.util.List’import=’java.util.ArrayList’ %>
D.<%@ import types=’java.util.List’types=’java.util.ArrayList’ %>
E.<%@ page import=’java.util.List,java.util.ArrayList’ %>
F.<%@ import types=’java.util.List,java.util.ArrayList’ %>
You are creating a new JSP page and you need to execute some code that acts when the page is firstexecuted, but only once.
Which three are possible mechanisms for performing this initialization code?()
A.In the init method.
B.In the jspInit method.
C.In the constructor of the JSP’s Java code.
D.In a JSP declaration, which includes an initializer block.
E.In a JSP declaration, which includes a static initializer block.
Given the element from the web application deployment descriptor:
<jsp-property-group>
<url-pattern>/main/page1.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>
</jsp-property-group>
and given that /main/page1.jsp contains:
<% int i = 12; %>
<b><%= i %></b>
What is the result?()
A.<b></b>
B.<b>12</b>
C.The JSP fails to execute.
D.<% int i = 12 %><b><%= i %></b>
In a JSP-centric web application, you need to create a catalog browsing JSP page. The catalog is stored asa List object in the catalog attribute of the webapp’s ServletContext object.
Which scriptlet code snippetgives you access to the catalog object?()
A.<% List catalog = config.getAttribute("catalog"); %>
B.<% List catalog = context.getAttribute("catalog"); %>
C.<% List catalog = application.getAttribute("catalog"); %>
D.<% List catalog = servletContext.getAttribute("catalog"); %>
For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked.
Which JSP code snippetmust you use to declare this instance variable in the JSP Document?()
A.<jsp:declaration>int count = 0;<jsp:declaration>
B.<%! int count = 0; %>
C.<jsp:declaration.instance>int count = 0;. <jsp:declaration.instance>
D.<jsp:scriptlet.declaration>int count = 0;. <jsp:scriptlet.declaration>
最新試題
Given a web application in which the request parameter productID contains a product identifier.Which twoEL expressions evaluate the value of the productID?()
Which ensures that a JSP response is of type "text/plain"?()
You are building a dating web site. The client’s date of birth is collected along with lots of other information.The Person class has a derived method, getAge():int, which returns the person’s age calculated from thedate of birth and today’s date. In one of your JSPs you need to print a special message to clients within theage group of 25 through 35.Which two EL code snippets will return true for this condition? ()
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?()
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?()
Which three are true about servlet filters?()
You need to create a JSP that generates some JavaScript code to populate an array of strings used on the client-side.Which JSP code snippet will create this array?()
Click the ’Select and Place’ button.Place the events in the order they occur.
Click the ’Select and Place’ button.Place the events in the order they occur.
Click the ’Select and Place’ button.Place the events in the order they occur.