Hi,
I have a doubt in <
jsp:usebean> tag. when we use <jsp:usebean> it tries to get an attribute defined at the specific scope.If no attributes is present , we can even create new attibute at the specific scope. If we dont specify any scope,default scope is "page".As per my underatstanding,if we define any scope along with <jsp:usebean> and if attribute is not present in that scope it will not search the remaining scopes(request,session.application etc).
In the page 356 of HFSJ an example is given like below:
JSP page:
<jsp:usebean id="person" type="foo.employee">
<jsp:setproperty name="person" property="name" value="fred"/>
</jsp:usebean>
name is<jsp:getproperty name="person" property="name"/>
Then 3 quetions were asked in which my first two anwsers match with book answers.
Third questions is:
Servlet code:
foo.employee e=new foo.employee();
p.setName("evan");
request.setAttribute("person",p);
Above servlet code sets an attribute in the request scope.How cane the JSp code <jsp:usebean> gets an attribute at the request scope and prints the name value?(Because scope attribute is not defined with <jsp:useban> tag and default scope is "page").
Please help me in understanding this question.