Saket Kumar Sinha

Ranch Hand
+ Follow
since Aug 04, 2011
Saket Kumar likes ...
Eclipse IDE Java Tomcat Server
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 Saket Kumar Sinha


I have one class Name Person
which has properties as name and List<Person>

SO Example

Now this Person class can be a List and can be upto any heirarchy
For ex : Grandparents, Parents, children. It is 3 level heirarchy.

Now, Consider i have one List<Person> object which contains upto three/two mixed level of heirarchy

I have another list which also contains mixed three/two level heirarchy.

I want to remove Persons which are not there in 2nd list and present in 1st list. it could be at any heirarchy. when i remove the whole heirarchy below it gets deleted.
Similary if there is some person which is there in 2nd list and not in 1st List i want to add those in 1st list at that level

I know there is some sort of Tree to handle this. Please point me in right direction.
4 years ago

Hi All,

I am using SocketAppender for Logging. All Logs are getting logged into one remote server which is listening the log events on some socket.
My Problem is if remote logging server is down then log events are not getting captured.
I want that if remote logging server is down then the log should be appended to file in the local System.
Is this type of configuration is possible.
Please help me with some suitable links !!

HI Kemal, Thanks for the response. I understood the concept.
6 years ago
I think i have got the answer for myQuestion.
toString() method is automatically called while printing only object. and hence the innerList object toString method is called and the values are printed.
6 years ago
I wrote the following code

It gives me output
After Modification [30, [40, 50, 60], 20]
As i have added a list after position 1 and calling tostring Method on alList not on alList1. How the data of alList1 also getting properly.
I know the toString() is overridden but just can't believe that it prinitng the values for innerList at position 1 also.
Can any one help me here? What i am not able to think
6 years ago
Try Setting the path as

C:\Program Files\Java\jdk1.6.0_23\bin;

and restart the system. Sometimes closing and opening the Cmd works.

Hope this helps
6 years ago

That may help
6 years ago
Since you are returning ArrayList

This would print all the data. for proper formatting you can use table tag. and can put the result in tr and td.
6 years ago
Ya missed one thing and moreover we dont have request and response object to be passed to the forward method of requestDispatcher .
I got your point now.
Thanks !!
6 years ago

Bear Bibeault wrote:

Saket Kumar Sinha wrote:Not sure whether this is the appropriate way to do it

It is not. In fact, it is impossible to do that as there is no request and response with which to create the dispatcher.

You will need to create a servlet filter than can check if the session has expired or not. You will know if it has because you will have placed a token or some other object in the session to indicate the the user is logged in. If that object is missing, the session has expired or been destroyed.

Your filter can then take whatever action is required.

Ya. Thanks Bear. i thought that i can get HttpSession obj from the HttpSessionEvent's getSession() method and then using the HttpSession obj i can get the servletContext and then the requestDispatcher. but we should not create a new session when this SessionDestroyed method is called when the session is destroyed.
Hope i understood your point
6 years ago
Why can't we take the servletContext in SessionDestroyed method and call requestDispatcher method on servletContext obj for dispatching it to the page which
shows that your page has expired.
Not sure whether this is the appropriate way to do it
6 years ago

I don't think when we make producer in WebService we will have a main method. Only a interface implementation is there. Like you made for addition of two numbers. The Consumer (Client) will have a main method which will use the service class to get the port. and then we can invoke using the endpoint url.
I am not sure why you are not able to test your webservice though
6 years ago
I think you can check the HttpSession listener class. we have two methods in that. Session created and SessionDestroyed. that may help
6 years ago
== operator checks for references. You should have used equals() method for string comparison
6 years ago
Ya i figured it out. It's LF(Line Feed) and CR(carriage Return)
6 years ago