Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Question on Standard actions

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Thanks Satou!!.Now it is clear!!!

Regards,
Priya.
 
You didn't tell me he was so big. Unlike this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic