Help coderanch get a
new server
by contributing to the fundraiser

Peter Piddle

+ Follow
since Jun 13, 2012
Peter likes ...
IntelliJ IDE jQuery Tomcat Server
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 Peter Piddle

Hi Frits,

Thanks a ton. I thought of the same thing.

Hi Frits,

Thanks a ton man. I understood the concept clearly. Thanks again.

I have started reading chapter-7 from HFJS. There are different questions there. A question is written there which says that.
Suppose you do want ot override the init() method.. how would you do it? I know this part, we can override it by using jsp elements

Onwards it says that, Is there something else you can do that'll give you the same result? I couldn't get it. Can we do it some other way
as well?

Thanks Frits. I was a little confused at the Serialization part. It says that

But a Container is not required to use serialization

Where earlier it says something like this

A container is required to migrate Serializable attributes

I am confused between these two statements. Can you elaborate on this part?
Hi All,
I am re going through chapter 6 where i felt weak and now on page 260 here is a whole concept i am unable to understand. Please help me understanding it.
It says that

Session Migration and Serialization
A container is required to migrate Serializable attributes(which assumes that all instances variables within the attribute are either Serializable or null.
But a Container is not required to use serialization as the mean of migrating HttpSession Object
What does that mean to you? Simple make sure you attribute class types are Serialzable and you never have to worry about it.
But if the yare not Serializable (which could be because on of the attribute object's instance varibales i snot Serializable), have your
attribute object class implement HttpSessionActivationListener and use the activation/passivation callsback to work around it.

The container is not required to use Serialization, so there's no guarantee that readObject() and writeObject() will be called on a
Serializable attribute or one of its instance variables!

If you are familiar with Serialization, you know that a class implements Serializable can also choose to implement a writeObject()method, called by the
VM container whenever an object is serialized and a readObject() method, called when an object is deserialized. A Serializable object can use these
methods to for example, set non-Serializable fields to null during Serialization(writeObject() and then restore the fields during deserialization(readObjet()).
But the methods won't necessarily be called during session migration! So if you need to save and restore instance variable state in your attribute, use
HttpSessionActivationListener, and use the two event calledbacks(sessionDidActivate() and sessionWillPassivate()) the way you would use readObjet()
and writeObject()

Please help. I am totally lost in what the book is trying to tell.
Hi All,
I am solving mock from K&B from Chapter 6. The question asks

Which method(s) can be used to ask the container to notify your application whenever a session is about to timeout?
Options correct are A and C

  • A.HttpSessionListener.sessionDestroyed
  • C. HttpSessionBindingListener.valueUnBound

  • My question is the valueUnBound() method is related when an attribute is removed from the session, session might be existing that time.
    Then why option C is made correct?

    I am reading Head First JSP and Servlets and preparing for the exam. It says in topic of HttpSessionBindingListener, that its valueBound() and valueUnBound() can be used when we need to synchronize with the database. I am not aware much about entities with respect to databases. But that is what i get that let say we can make Dog class an Entity and make it implement HttpSessionBindingListener. But still i am unable to understand when we say when it is added to session and it is removed, how valueBound() and valueUnBound() can help synchonize with the database. Are these methods where we will be doing database CRUD operations?
    Hi All,
    There won't be a separate study group guys. We will follow up on ranch itself. Now question is first we should first share the
    exam deadlines and tell what is the preparation level of everyone.

    Please let us know who is giving exam end of August.

    Dear Don,
    Seems like your query is already clarified.
    Hey Don,
    I am also planning to fight the battle end of August. Clear concepts and rock the exam. My timezone is GMT +4
    So what is your current status of preparation?
    Hi Don,
    What is your exam proposed date? What's your time-zone ? Yes we can use voice and emails and javaranch obviously.
    Let me know.
    Hi people.
    I just searched through the forum and i have seen such topics before. But is anyone interested in joining me as a partner for certification
    Thankyou Anay. I would definitely keep your suggestions in mind. Thanks a ton.
    I guess certification is for concepts. We need to develop hard core solid experience in developing program but obviously
    the the journey of thousand miles begin with a single step and the initial step can be the certification itself. That's what i am
    doing too. Welcome to javaranch.
    Hi Anay,
    What would be the best possible way? Should i read the full chapter first and then come up with some working examples?
    I want to under java IO in and out as it gives me headaches many times. I want to come up with some small but useful working
    program. Can you suggest me a small application to make? I will take your advice to read 1 hour daily rather then to read 5 in a day
    and skip. It's very important. Thanks a ton.