Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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

doubt in page 356 of HFSJ

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a doubt in <jsp:usebean> tag. when we use <jsp:usebean> it tries to get an attribute defined at the specific scope.If no attributes is present , we can even create new attibute at the specific scope. If we dont specify any scope,default scope is "page".As per my underatstanding,if we define any scope along with <jsp:usebean> and if attribute is not present in that scope it will not search the remaining scopes(request,session.application etc).

In the page 356 of HFSJ an example is given like below:
JSP page:
<jsp:usebean id="person" type="foo.employee">
<jsp:setproperty name="person" property="name" value="fred"/>
</jsp:usebean>
name is<jsp:getproperty name="person" property="name"/>

Then 3 quetions were asked in which my first two anwsers match with book answers.
Third questions is:
Servlet code:
foo.employee e=new foo.employee();
p.setName("evan");
request.setAttribute("person",p);

Above servlet code sets an attribute in the request scope.How cane the JSp code <jsp:usebean> gets an attribute at the request scope and prints the name value?(Because scope attribute is not defined with <jsp:useban> tag and default scope is "page").
Please help me in understanding this question.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"swapna d",
Thank you for changing your name, but it still does not fit the Naming Policy requirements. As stated, you can use an initial or initials for the first name if you like (but not the last). Could you please change it again ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is already in the errata, page 416.
 
Maybe he went home and went to bed. And took this tiny ad with him:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic