Chintu Singh

Greenhorn
+ Follow
since May 08, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 Chintu Singh

Hi All,
Can any of you help and explain the below text from "HeadFirst Servlets & JSP" on Context Synchronization.(Page 197)

"If code does not ask for the lock, then that code is still free to hit the context attributes.
But is you are designing the web app, then you can decide to make everyone ask for the lock before accessing the attributes".

I am not able to understand 2nd part of the text, how do we ask everyone for the lock before accessing context attributes.
10 years ago
SCJP
Kathy Sierra and Bert Bates
Hello All,
As per "HeadFirst Servlet and JSP" - Page 153
init-param can be provided to servlet using DD. But we should restart and redeploy the applications to get updated init-param.
We have the option for hot deployment or we can have init param stored in DB which will give us a bad performance.

Can you please explain the best practices or approach used in web application?

Thanks
10 years ago

Hello All,
I have a small doubt in Servlets.

Does container always call init(ServletConfig)? or it is called only if we have init parameters in DD.
What is the purpose of non-arg init(), if Container calls only init(ServletConfig).

Please help.
10 years ago
Two threads are running on different instances. So you cannot predict the output. The answers you have given will not be always true.
I am studying "Head First Servlets & JSP".
I have a small doubt. Do we really need to concentrate on deployment environment, explained in Chapter 3 Mini MVC?
Because on the job, we create .war,.ear using IDEs and deploy it to weblogic server.

Thanks

I paid 8400 Rs on July 15th, 2013.
Thanks to all you.
I learnt a lot from here.
10 years ago
sleep method does not release the lock on myRunnable.
When jvm runs the code in the main method's synchronized block, even after starting the thread t1 which has myRunnable as target cannot run the thread as it needs lock on myRunnable to run the thread. And the lock is not available as it is alraedy taken by main method.
So main method's synchronized block will complete and set the entries in array as A, B and C.
And after the releaseing the lock from main method's synchronized block, it will print ABC as per run method of MyRunnable.

I hope this solves your doubt.
Ohh My God!
Sorry to know about it.

What could be the reasons for this?
Can you please tell?
10 years ago
The classpath is disturbing me a lot
Can anybody help on the following text form K&B book.
Let's use the same directory structure and a different classpath:

Directory Structure



Command is :



In this case, what directories will be searched if the current directory is dirA?
How about if the current directory is root? How about if the current directory is
dirB? In this case, both paths in the classpath are absolute. It doesn't matter what
the current directory is; since absolute paths are specified the search results will
always be the same. Specifically, only dirC will be searched, regardless of the current
directory. The first path (/dirB) is invalid since dirB is not a direct subdirectory of
root, so dirB will never be searched. And, one more time, for emphasis, since dot (.)
is not in the classpath, the current directory will only be searched if it happens to be
described elsewhere in the classpath (in this case, dirC).

Please help.
Hi,
Congratulations for your certification.

Did you find any Drag and Drop questions?
And did you find questions which ask to "select all that are true/false" without telling the numbers of right/wrong options?

Now i got it.

Following code can change company name.



Thanks a lot for replying.
Can anybody explain me why am i getting output as "ABC ABC ". I am little confused on this.
I know that this is a very silly question. c is referring to a new Employee object which has company name as Un-Employed. and it is not being set to e's company. but if we have a valid reference to existing company ABC, why cannot we change its value?