• 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

Question on Standard actions

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Plz clarify my doubt for the following question.

<jsp:usebean id="person" type="foo.employee">
<jsp:setProperty name="person" property="name" value="fred"/>
</jsp:usebean>
<jsp:getProperty name="person" property="name"/>

1)foo.person p = new foo.employee();
p.setName("Evan");
request.setAttribute("person",p);

2)foo.employee p = new foo.employee();
p.setName("Evan");
request.setAttribute("person",p);

In HFSJ,it is given that the first servlet & JSP pair wont work because usebean action will search the "person" in page scope since the scope attribute is missing in the usebean action and it defaults to "page".
Whereas the actual "person" object available only in request scope.I totally agree with this.But it is also given that the third servlet & JSP pair will work & print "Evan".How it is possible?.Here also "person" is set in the request scope & it should also fail right?.I dont understand the difference.Would request someone to clarify.

Thanks in advance..

Regards,
Priya.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't own the book, so I don't know which page it is,
but looking at the errata,
I found this :

[416] Be the Container Answers;
The third example will not work for the same reason that the first example doesn't
work, because the attribute is at Request Scope, and the default scope is Page scope.
The handwritten comment for bullet #3 should be the same as for bullet #1.

Wouldntt that be your problem ?
 
Priya Jothi
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Satou!!.Now it is clear!!!

Regards,
Priya.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic