meera kanekal

Ranch Hand
+ Follow
since Feb 13, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by meera kanekal

Hi,
I no longer live in Boulder. CO. So I am not interested.
Thanks,
Meera
Hi,
The source code for this question is taken from the HFSJ book by KBB 2nd Edition, CH 8 page 380. Only the jsp is mine based on the source code.
Toy.java



Dog.java


Person.java


DogToyServlet


DogToys.jsp


So all the above work. But I want to access the "person" attribute using pageContext implicit object.
If I use the following I get an error.

From the PageContext API I found that the implicit object "request" is a ServletRequest. Then I tried the following in a scriptlet and it works.


So I am wondering if I can conclude that the did not work because the request is a ServletRequest and not a HttpServletRequest?
So the follow up question is do any of you know how I can access person's name using pageContext?

Sorry if the question seems lengthy but I thought it would be easy to follow if the code is pasted as well.

Thanks,
Meera

Hi,
I have a question regarding an EL syntax that shows up in the IDE Eclipse I am using, but compiles and runs without any problem. Can anyone shed some light on that? This is the jsp and the error is only for the EL expression ${mine:rollIt()}. The other expression is fine.


Thanks,
Meera
Thank you Ankit for your input.
Regards,
Meera
The reason I asked was because I was not able to totally get it. I thought this was a friendly forum where you could ask questions if you could not figure it out.
Meera
Hi,
I am studying thru CH 8 from HFSJ and had a question regarding the Code Magnet Answers from page 382. The authors mention about the "Bonus exercise: write the EL expressions a little differently (forget the magnets), but print the same result". The exercise is for composing the EL for the output:
Leelu's dog Clyde's toys are: stick, neighbor's cat, and a Barbie doll head.
I am wondering if any of you have an answer to that?
Will be much obliged.
Thanks,
Meera
Hi All,
Just checked on the forum and found that I am one of the winners. First time I've won any thing. Looking forward to reading it.
Thanks,
Meera
Thanks everybody. It makes sense now.
Meera
Yes on page 420 in the answer section the explanation given is it "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. The Container knows that if you have only a type specified there MUST be an existing bean attribute of that name and scope"
I am confused with this explanation because it seems to be talking about 2 different things as to why it fails:
1) scope: request, page
2) use of type.
Here the bean Employee is already existing. So that must not be the reason why it failed. So it fails because the scope is request?
My take on it was that Person is abstract and Employee is concrete and when type is used without class where there is an inheritance it fails.
Please clarify.
Thanks,
Meera
Hi,
I am trying to understand the use of type and class in the jsp standard action <jsp:usebean> . I have 2 questions regarding this.
1. In HFSJ Ch 8 pg 356 (we have abstract class Person and concrete class Employee) it says that
“If type is used without class, the bean must already exist”
but then in the example given:
<jsp:usebean id=”person” type=”foo.Person” scope=”page”/>
it works if the person attribute already exists in “page” scope otherwise you get an InstantiationException.
So I am assuming the authors are saying that if Person were a concrete class using type without class will work if person attribute is in page scope otherwise you will get the exception. Does that mean that if Person were a concrete class and the attribute was not in page scope you would get an error? Can anyone please clarify this for me?
2. My second question concerns the quiz “Be the Container” on pg 358.
Here we have:
<jsp:usebean id=”person” type=”foo.Employee” scope=”request” >
<jsp:setProperty name=”person” property=”name” value=”Fred”/>
</jsp:usebean>

Name is: <jsp:getProperty name=”person” property=”name”/>

The servlet code is:
foo.Person p = new foo.Employee();
p.setName(“Evan”);
request.setAttribute(“person”, p);

We know that the body of the tag will never run if the bean already exists. If the bean already exists then using type=”foo.Employee” should work. Why does it not work here? Is it because the Container knows that Employee is a subclass of Person? Would it have worked if Employee were not a subclass of Person and the servlet code said
foo.Employee e = new foo.Employee();
p.setName(“Evan”);
request.setAttribute(“person”, p);

I appreciate your input in advance.
Thanks,
Meera.



Hi,
I am studying for SCWCD and was wondering if anyone else is interested in joining with me in studying together in Boulder, CO. If there is an existing study group then I would be interested in joining.
Thanks,
Meera
Hi,
I passed SCJP 5 with 86% and now I want to start preparing for SCWCD. I would like some advise on what is the best way to prepare for the exam. I am able to prepare full time. I have bought the SCWCD exam guide by Kunal Jaggi, and Head First Servlets. Which book should I start with? I have some previous work experience in Servlets and JSP but I haven't worked on it in the last one year. So I have to put in some extra time in preparing. Your input will be appreciated.
Thanks,
Meera
Hi Ranchers,
I will be in Bengaluru fpr the next 3 months visiting family and would like to give the exam there. To continue my preparation can any of you recommend good training institutes there.
Thanks,
Meera

So it means that the Animal part of Dog is reset but the Dog's variable -- name is not. Thank you both Punit and Ruben for clarifying this concept.
Regards,
Meera
Corrected Code