This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in page 356 of HFSJ

 
swapna rao
Ranch Hand
Posts: 53
  • 0
  • 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.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • 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
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is already in the errata, page 416.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic