• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in jsp:usebean

 
V Gala
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jsp:useBean id = "person" type = "foo.Employee">
<jsp:setProperty name="person" property="name" value ="fred"
</jsp:useBean>

servlet code (pg 256)

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

IN HFS it is given above code will run successfully
person attribute is at request scope.
so above code should not work
 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
person attribute is at request scope.
so above code should not work


I agree
 
V Gala
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code is from HFS
Can anyone give me a link of errata for HFS
thanks in advance
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think <jsp:useBean> searches sequentially for bean in page,request,session and application scopes.

No. The scope defaults to "page".

I don't know which version of the book you have, but isn't this already in the errata ? (page 416)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic