File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ 2nd edition page 420 - Be the Container Answers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ 2nd edition page 420 - Be the Container Answers" Watch "HFSJ 2nd edition page 420 - Be the Container Answers" New topic

HFSJ 2nd edition page 420 - Be the Container Answers

Reesha Ashok
Ranch Hand

Joined: Apr 05, 2008
Posts: 32
I have a doubt on the explanation for "Be the Container Answers"

JSP standard action

<jsp:usebean id="person" type="foo.employee" scope = "request">
<jsp:setproperty name="person" property="name" value="fred"/>
name is<jsp:getproperty name="person" property="name"/>

First question is
Servlet code:
foo.Person p = new foo.employee();

And the answer says "Fails at request time! The person attribute is stored at request scope, so the <jsp:usebean> tag won't work since it specifies only a type "
But, the <jsp:usebean> tag has the scope specified as request. Since the scope specified in the tag and the scope where the attribute is stored is "request" why shouldn't the usebean tag work?
Can anybody please help clarify?
[ April 05, 2008: Message edited by: R Nellika ]

Thanks & Regards,<br />Reesha
Devasani Naresh

Joined: Sep 20, 2007
Posts: 18
Hello Nellika,

I found your "Be the Container Answers" at page 416. I dont know which version of book i am using.

In my book, it scope attribute is not specified with jsp:useBean tag. So, by default, it will be page. In that case this answer might be correct.

But this might be a chance that "in the new version of book, they have specified scope, but not corrected the answer".

It is sorta covered in the JavaRanch Style Guide.
subject: HFSJ 2nd edition page 420 - Be the Container Answers
Similar Threads
bean-related standard actions exercise
Question from HF second edition
jsp:useBean related doubt
Using jsp:useBean without class attribute
Question regarding EL and standard action from HF Servlets and JSP