Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question to Kathy

 
sachin kelkar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kathy,
Thanks a lot for writing such a nice book on Head First for Servlet
& JSP.But I havent understand

This example given from HF-Servlet & Jsp [Page-416]

Eg:-Look at this standard action:--

<jsp:useBean id="person" type="foo.Employee">
<jsp:setProperty name="person" property="name" value="Fred" />
</jsp:useBean>
<jsp:getProperty name="person" property="name" />


3> What happens if the servlet code like:-

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

HF answered that this works fine & prints out 'Evan'.

But I work it out.

FAILS at request time.person attribute is stored at request scope.
<jsp:useBean> can't find an attribute object named "person" at page scope
which is defaults scope.
Will it be wrong or right?
Suggestions are welcome!
 
Vishnu Prakash
Ranch Hand
Posts: 1026
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic