The STANDARD ACTION: <jsp:useBean id="person" type="foo.Employee" > <jsp:setProperty name="person" property="name" value="Fred" /> </jsp:useBean>
SERVLET CODE: foo.Employee p = new foo.Employee(); p.setName("Evan"); request.setAttribute("person", p);
Question: What will the output for this be <jsp:getProperty name="person" property="name" />
Answer in Book: The book states that this work fine and prints out Evan. The code inside the body of <jsp:useBean> will never run, since we specified a type without class.
I FEEL: IT SHOULD FAIL AT REQUEST TIME cos when the scope is not mentioned in the useBean tag, so it defaults to the page scope. When only the type is mentioned in the useBean tag there should be an existing attribute bean with the same name and scope. Here the scope is not same. The attribute bean exists in the request scope. The tag is searching in the page scope
The book anyhow contradicts the answer by saying when only the type is mentioned in the useBean tag there should be an existing attribute bean with the same name and scope
This is where the head first gets clumsy i have borken my head over this page as it has got an errata but even after this the THING isnt yet clear, so i too BRUSHED the page aside and continued further
SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ] Performance is a compulsion, not a option, if my existence is to be justified.