Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp question

 
krishna bose
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a JSP-centric shopping cart application, you need to move a client's home address of the Customer object into the shipping address of the Order object. The address data is stored in a value object class called Address with properties for: street address, city, province, country, and postal code. Which two JSP code snippets can be used to accomplish this goal? (Choose two.)

A. <c:set var='order' property='shipAddress' value='${client.homeAddress}' />

B. <c:set target='${order}' property='shipAddress' value='${client.homeAddress}' />

C. <jsp:setProperty name='${order}' property='shipAddress' value='${client.homeAddress}' />

D. <c:set var='order' property='shipAddress'>

<jsp:getProperty name='client' property='homeAddress' />

</c:store>

E. <c:set target='${order}' property='shipAddress'>

<jsp:getProperty name='client' property='homeAddress' />

</c:set>

F. <c:setProperty name='${order}' property='shipAddress'>

<jsp:getProperty name='client' property='homeAddress' />

</c:setProperty>

Answer: B, E //ok



My question is why c is not the answer….
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In the spec:
The jsp:setProperty action sets the values of properties in a bean. The name
attribute that denotes the bean must be defined before this action appears.

name The name of a bean instance defined by a <jsp:useBean>
action or some other action. The bean instance must contain
the property to be set. The defining action must appear
before the <jsp:setProperty> action in the same file.

Kathir
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic