Your web site has many user-customizable features, for example font and color preferences on web pages.Your IT department has already built a subsystem for user preferences using the Java SE platform’s lang.util.prefs package APIs, and you have been ordered to reuse this subsystem in your web application. Youneed to create an event listener that constructs the preferences factory and stores it in the applicationscope for later use. Furthermore, this factory requires that the URL to a database must be declared in thedeployment descriptor like this:
42.
A.
B.
C.
D.
您可能感興趣的試卷
你可能感興趣的試題
Servlet A receives a request that it forwards to servlet B within another web application in the same webcontainer. Servlet A needs to share data with servlet B and that data must not be visible to other servlets inA’s web application.
In which object can the data that A shares with B be stored?()
A.HttpSession
B.ServletConfig
C.ServletContext
D.HttpServletRequest
E.HttpServletResponse
The sl:shoppingList and sl:item tags output a shopping list to the response and are used as follows:
12.<sl:item name="Bread" />
13.<sl:item name="Milk" />
14.<sl:item name="Eggs" />
15.</sl:shoppingList>
The tag handler for sl:shoppingList is ShoppingListTag and the tag handler for sl:item is ItemSimpleTag.ShoppingListTag extends BodyTagSupport and ItemSimpleTag extends SimpleTagSupport.Which is true?()
A.ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling getParent() and castingthe result to ShoppingListTag.
B.ShoppingListTag can find the child instances of ItemSimpleTag by calling super.getChildren() andcasting each to an ItemSimpleTag.
C.It is impossible for ItemSimpleTag and ShoppingListTag to find each other in a tag hierarchy becauseone is a Simple tag and the other is a Classic tag.
D.ShoppingListTag can find the child instances of ItemSimpleTag by calling getChildren() on thePageContext and casting each to an ItemSimpleTag.
E.ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling findAncestorWithClass()on the PageContext and casting the result to ShoppingListTag.
Given the JSP code:
<% request.setAttribute("foo", "bar"); %>and the Classic tag handler code:
5. public int doStartTag() throws JspException {
6. // insert code here
7. // return int
8. }
Assume there are no other "foo" attributes in the web application.
Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()
A.String x = (String) pageContext.getAttribute("foo")
B.String x = (String) pageContext.getRequestScope("foo")
C.It is NOT possible to access the pageContext object from within doStartTag
D.String x = (String) pageContext.getRequest().getAttribute("foo")
E.String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)
Click the Exhibit button.
The attribute "name" has a value of "Foo,"
What is the result if this tag handler’s tag is invoked?()
A.Foo
B.done
C.Foodone
D.An exception is thrown at runtime
E.No output is produced from this code
F.Compilation fails because of an error in this code
最新試題
Which ensures that a JSP response is of type "text/plain"?()
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.<context-param>43.<param-name>webmasterEmail</param-name>44.<param-value>master@example.com</param-value>45.</context-param>Which JSP code snippet creates this email link?()
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.
Which two are valid and equivalent?()
You are building a web application with a scheduling component. On the JSP, you need to show the currentdate, the date of the previous week, and the date of the next week. To help you present this information,you have created the following EL functions in the ’d’ namespace: name: curDate; signature: java.util.DatecurrentDate() name: addWeek; signature: java.util.Date addWeek(java.util.Date, int) name: dateString;signature:java.util.String getDateString(java.util.Date)Which EL code snippet will generate the string for the previousweek?
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? ()
Click the ’Select and Place’ button.Place the events in the order they occur.
You are building your own layout mechanism by including dynamic content for the page’s header and footersections. The footer is always static, but the header generates the <title> tag that requires the page name tobe specified dynamically when the header is imported.Which JSP code snippet performs the import of theheader content?()
Click the Exhibit button.The attribute "name" has a value of "Foo,"What is the result if this tag handler’s tag is invoked?()