• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

whats the diff

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i am preparing for scwcd.i am reading hfsj book i am not clear with this plz some one explain me
<jsp:usebean id ="person" class = "foo.person" scope="request">
<jsp:setproperty name ="person" property=name value=fred"/>
</jsp:usebean>

and
<jsp:usebean id ="person" class = "foo.person" scope="request"/>
<jsp:setproperty name ="person" property=name value=fred"/>

what is the difference between two.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the different is, in the statement

<jsp:usebean id ="person" class = "foo.person" scope="request">
<jsp:setproperty name ="person" property=name value=fred"/>
</jsp:usebean>


because <jsp:setproperty name ="person" property=name value=fred"/>
in the body of <jsp:useBean.. then person.name is just assigned by Fred if bean person is not exist. imagine if person.name is already set from previos JSP or servlet and no need to overwriiten by new value.


But in this statement,

<jsp:usebean id ="person" class = "foo.person" scope="request">
<jsp:setproperty name ="person" property=name value=fred"/>


person.name is always write by 'Fred'. What happen if in person.name is already assign by 'Anshu'?. it will overwritten also, so yu will never get 'Anshu' in person.name after the statement.


Hope this help Anshu..

Joko
 
anshu sahai
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic