• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SCWCD prep Doubt

 
Ajay Kumar Sharma
Greenhorn
Posts: 4
Chrome Eclipse IDE Windows Vista
  • 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>

Why "C" AND "F" is not the answer..?

Ans is given as: B and E
 
Roel De Nijs
Sheriff
Posts: 9934
113
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
QuoteYourSources please.
 
Ajay Kumar Sharma
Greenhorn
Posts: 4
Chrome Eclipse IDE Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Taken it from same community.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajay Kumar Sharma wrote:Taken it from same community.

You may need to specific about the source (book, web link etc...).

And welcome to CodeRanch!
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2345
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the topic came from here: old thread

but it lacks the source..

Regards,
Frits
 
Ajay Kumar Sharma
Greenhorn
Posts: 4
Chrome Eclipse IDE Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys

What i think is E can't be the Ans. Because <jsp:getProperty name='client' property='homeAddress' /> will return address as string and we can't give address a string value
 
Hermann Laghom
Greenhorn
Posts: 18
Java Mac PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think C and F are not correct because the name attribute is taking an EL expression. it will work if you put 'order'
 
Ajay Kumar Sharma
Greenhorn
Posts: 4
Chrome Eclipse IDE Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hermann Laghom wrote:i think C and F are not correct because the name attribute is taking an EL expression. it will work if you put 'order'


Yeh That i Got. But What about 'E'
 
Hermann Laghom
Greenhorn
Posts: 18
Java Mac PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you know will return the homeAddress value of the "client" object
and the c:set action will call the setter method of the property shipAddress. We have no information about this method, so i think it could be something like
who takes a string argument and could create an object Address.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic