2017年11月30日 星期四

QUESTION 85

View the Exhibit.

image

Assume the product attribute does NOT yet exist in any scope. Which two create an instance of
com.example.Product and initialize the name and price properties to the name and price request parameters? (Choose two)


A. 
    <jsp:useBean id="product" class="com.example.Product" />
     <jsp:setProperty name="product" property="*" />
B.
    <jsp:useBean id="product" class="com.example.Product" />
     <% product.setName( request.getParameter( "name" ) ); %>
     <% product.setPrice( request.getParameter( "price" ) ); %>
C.
    <jsp:useBean id="product" class="com.example.Product" />
    <jsp:setProperty name="product" property="name" value="${param.name}" />
    <jsp:setProperty name="product" property="price" value="${param.price}" />
D.
    <jsp:useBean id="product" class="com.example.Product">
        <jsp:setProperty name="product" property="name" value="${name}" />
        <jsp:setProperty name="product" property="price" value="${price}" />
    </jsp:useBean>.


Correct Answer: AC

沒有留言:

張貼留言