Neeraj Vij

Ranch Hand
+ Follow
since Nov 25, 2003
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 Neeraj Vij

is this good and correct ?

thnx
neeraj
8 years ago
Hi,

thanks to all of you. I was also aware of these things. But was thinking from a different point of view. is this not violating basic oops principle of inheritence ? child is inherting from its parent but in some cases its not like its parent

consider this scenario

1.) Class A extends Thread
2.) Class B extends Thread
3.) Class C extends A


can you say that class C is not a Thread only A and B are Threads? I believe in case of exception its happening like above scenario. please. correct me if I am wrong.

Thanks again for your inputs.

Regards,
Neeraj.

8 years ago
Dear All,

- When we extend the Exception class, those custom Exceptions are treated as Checked exception

- When we extend the RuntimeException class, those custom Exceptions are treated as UnChecked exception. My query is why? Since the parent class of RuntimeException is also Exception why custom classes extending RuntimeException are not treated as checked exception.

What is the code written in Exception class which stops this behaviour?

Regards,
Neeraj.

8 years ago
Thanks a ton for your clarification...I got it...it will work when you have the exact reference
8 years ago
Hi,
thanks both for your inputs.

I was expecting the following to return false


then why its required to overide equals when using custom objects with hashset?
8 years ago
Hi All,

I have not overridden the equals and hashcode method in the below mentioned code. I am unable to get, why contains method returns true.



8 years ago
Hi,

I have the following java code for creating a thread safe singleton.



please provide inputs for the following -

1.) is the above code correct for creating a thread safe singleton object ?

2.) if yes, what will happen if 2 threads will use class.Forname to load the above class. will there be more than one instance.

Thanks
Neeraj
8 years ago
thanks for providing valuable inputs.. both seems very good.

I thougt of one more option using tag for redirecting it logout action and then redirecting the user to login

many thanks
neeraj.
8 years ago
I want to logout the user even if the session is active.

default session-timeout in web.xml will be for inactive session timeout. Please correct me, if I have got it wrong.


Thanks
Neeraj
8 years ago
How can I force a user to relogin for authentication after n {ex- 15 minutes} minutes irespective of the user session being active.

Thanks
Neeraj
8 years ago
I want to encrypt the request parameters before submitting the request and I don't want the user being able to view the method used for encryption in the .js file.

Many Thanks
Neeraj.
8 years ago

How can I prevent the user from downloading my javascript file in web application deployed in tomcat.

many thanks
neeraj.
8 years ago
Hi,

I have given in my web.xml to catch any handled exception in my struts based application and redirect the user to an error page.


But in some cases, it does not redirect the user to error page. instead the exception message is printed on the broken jsp.

Kindly advise, what could be reason for it and what else should be done in case any error occurs while processing the jsp and redirect the user to an error page.


Many Thanks,
Neeraj
8 years ago
Thanks to all of you for your inputs. Connection object is closed in main() and no operation will be allowed on the same object ,but, since the reference object in main is still not null, will it still be eligible for garbage collection ?

I just wanted some input regarding the performance issue considering the same scenario in a web application, since there could be multiple request which will be opening up connection objects, if those connectio objects are closed but not NULL, will it impact the performance of the application ?

Many Thanks,
Neeraj
Hello,

should the DB utility classes be used for closing the connections, if the connections is also obtained using the same DB utility classe. Since the connection returned from the getConnection() method has still a reference to the connection object which is never closed.

for example in the below mentioned example the connection is not null even after calling the metod for closing rhe connection.


{ please. ignore some typo mistakes}