Before jumping to answer your question, can you please post Employee Class also you might have miss something, and please let us know which page of HF example you doing and what error you getting!
I have been studying from Head First Servlets & JSP's and I found Be-the-Container example on chapter 8:
Now, there is a servlet code that gets called first and after it gets called it forwards to the above jsp:-
In the answers it says it works fine, but, however, when I tried it, it did not work fine, apparently because it stores the value in the request scope when the jsp:useBean uses the page scope.
Am I right? Is HF wrong? Am I missing something?
You are right..you should get an javax.servlet.ServletException: bean Employee not found within scope. This is because when the bean attribute is not found in the scope Contianer will try to do a new on the Employee and since it is a type exception occurs. Try changing the "type" to "class".
Thanks sridhar row for your reply. I guess you are right, if I change it to class, it would instantiate a new instance for the class and the name property would be Fred rather than Evan. Another solution would be to change the scope to request in which case the name property would be Evan rather than Fred.