Revathy Ravi wrote:

> Hello everybody,
> The situation is like this.
>
> I have an interface say I .  I have two classes, say A and B which
> implement this interface.
> I pass one of the object (say A) of these two classes in the session
> object. In the receiving servlet, I should be able to call the method of A
> without type casting or without checking.
>
> i.e., if I say Object o = session.getValue("A");
>         o.functionofA();
> How to do this?
>
>   Revathy R.
>

Assuming that the class of object "A" is AClass, you need to do this:

    AClass a = (AClass) session.getValue("A");
    a.functionofA();

Craig McClanahan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to