Meena R. Krishnan

Ranch Hand
+ Follow
since Aug 13, 2006
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Meena R. Krishnan

"Note also that getProperty will be called only once : when the bean is created in the session scope. Once the bean has been set in the session, its body will not be executed, so getProperty will not be called."

But, isn't the setProperty also in the body of the action?
>>So the scopes will be searched in the following order : page, request, session, and application.
So, what is the purpose of 'scope' in the <jsp:useBean ... ?

My understanding from HFSJ is, when the scope is given and if the bean could not be found (provided 'class' is also given) in the given scope, a new bean will be created and set, if <jsp:useBean> has a setproperty in its body.

I rewrote that part as below:

this time, I am setting a new attribute 'person2' (which does not exist in the request or anywhere). This time it worked when I tried to print the attribute from the SESSION as below:

The above code printed the values as 'SAName'. How come?
How can I view the container-generated servlet code of the JSPs? where does it gets stored? I am using Tomcat with Eclipse IDE. Thanks
Here it is..
In the servlet, I am setting an attribute in the request object. In the JSP, trying to create a new attribute in the session scope. And also, trying to print the above attributes in the request and session scope using EL.

SuperCreature is the base class of Person and Dog. And, Person has a Dog.

At step 1, trying to create a new bean in 'session' scope. A bean named 'person' already exists in 'request' scope as set by the servlet.

At step 2, printing the bean using EL that is in the sessionScope and at step3, printing the bean in the requestScope.

At 3, I see the expected result ie. the values set by the servlet.
but at 2, I don't see the values set by the Standard action tag <jsp:useBean>. Any ideas?
Yes. The Context Attributes are at the Application level which is available for all the servlets under the same web application.
You can find the details here:

getRemotePort() -- returns the port of the client that sent the request -- in this case it is

getRemoteHost() -- Returns the fully qualified name of the client that sent the request, which in this case will be "abc.def.ghi"

getServerPort() -- to which port was the request originally sent? , in this case it is

getLocalPort() -- where the request ended up -- in this case '"
[ August 24, 2007: Message edited by: M Krishnan ]
C is the correct answer. What is your doubt?
For servlet 2.4 & JSP 2.0, is version 5.5.x enough?
Thanks everyone !
17 years ago
Thanks to Kathy & Bert for the excellant book. This is the first technical book I have read after a long time from cover-to-cover again-and-again. Great Job!

Thanks to Paul Anil and team for the wonderful mock tool JQPlus. It really helped in getting a feel for the real exam.

And, thanks to Java Ranchers!
[ May 29, 2007: Message edited by: M Krishnan ]
17 years ago
Got it!
The subclass constructor SubClass(int, int), since it is not explicitly calling the super class constructor, a default no-arg constructor of the superClass will be inserted in order for it to get constructed and that's why the need for the no-arg constructor.
source : Enthuware

Which of the following constructors MUST exist in SuperClass for SubClass to compile correctly?

given answers:
public SuperClass(int a);
public SuperClass();

Why do we need the default constructor in this case? The only constructor that the subclass uses of superclass is the one that takes an int. Not sure why we need the no-arg constructor for the subclass point of view.
Source JMMock

question is, at line 1, the type parameter <T> is given but not being used and the compiler is not complaining. Is such a syntax ok?
Source: John Meyer's questions

a.Replace line 1 with main = c.getMain();
b.Replace line 1 with a call to coupler´┐Żs setMain method with the argument - main.
c.Replace line 2 with return pain; and make no other changes to the program.
d.No changes are required.
e.None of the above.

The answer given b. I feel both b and c are correct.

Thinking about it, may be not. Pain will not necessarily have the required main value all the time.
Anyway, what's the purpose of this code?
[ May 27, 2007: Message edited by: M Krishnan ]