This book rocks...I mean, its like crack. I can't get enough... but I have a question which I don't really understand from the book. I'm tempted to believe its wrong...but I could be too because they're certified and I'm still posting.
It basically says what happens if the servlet code looks like this:
now, according to the book, it blows up...but here's the thing, wouldn't the variable be on the existing page since the jsp being specified is requesting a scope of request type and this is exactly the same scope that is being set in the attribute of the calling servlet BEFORE it forwards to the jsp?
Am I too interprete page 356 which states Result if the person attribute already exists in "page" scope strictly? Or is it...wrong?
when you give the type alone,it means.. the container just looks for the available bean object and its clear ofcourse.. the point here is if we do not specify the class type and by chance if the bean does not exist in the scope .. the container has no way to know which object reference we need to assign since there is no class..
the above code you have provided is not corret in this context.. and which hfsj book are you using.. hfsj 2nd edition .. ?? page 358 has different information.. dude... i know i have answered only partially ..
Joined: Jan 27, 2007
Thanks for your reply. Yeah, this is the 2nd edition (Updated for EE5) version. The best way to prove this is probably just do it on my own (write an application) and post the results.
Do you think they will let met use the compiler for the test?
Joined: Jul 08, 2008
he he he... .. ya even i do not i understand why don't they allow us to use the compiler in the exam. ofcourse if we know the code only we can write.. and the objective of the exam is to prove that we know the coding..
Sun should consider this..option of allowing people to use compiler during the exam. ..
if only the "type" attribute is mentioned then the attribute with the same id which in our case is "person" should exist in the "request" scope.
It seems the web container does a check of something like:
if ( person attribute exists in request scope
&& [object referred by attribute "person" stored in "request" scope] instanceof
[type= say "foo.Employee"]
return the reference to that object referred to by person attribute
throw an exception