I have some
JSP code:
<jsp:useBean id="person" type="foo.Employee">
<jsp:setProperty name="person" property="name" value="Fred" />
</jsp:useBean>
I have the following
servlet code which does some work and forwards the request to the above JSP:
foo.Person p = new foo.Employee ();
p.setName("John");
request.setAttribute("person",p);
Now, this scenario is supposed to fail (as explained in Head First Servlets and Jsp book, Chapter is Scriptless Jsp). Can someone please explain to me why should it fail ? If we use only the type attribute the bean should already exist and I think the following line is doing that :
request.setAttribute("person",p);