Is it possible to do this:
in the servlet write a static method that take
HttpServletRequest, HttpServletResponse as parameter.
The doPost or doGet just call this method. And any
other servlet can it by the servlet class name too.
Will it work?
Thanks.
--- "Craig R. McClanahan"
<[EMAIL PROTECTED]> wrote:
> "Rajesh R.Basawa" wrote:
>
> > Hi ,
> > I'm using some base servlet which implement some
> interface.The controller will come to know wherther
> the request is processed properly or not by calling
> the interface methods which the servlet is
> implementing.I just wanna know is there way by which
> I can call member methods of servlet.
> >
>
> Servlets follow all the usual rules of Java
> programming. So, if you create a servlet that is a
> subclass of your base servlet, your subclass can
> call methods in the base servlet class as long as
> they are "public" or "protected", but not "private".
>
> Calling the methods of a servlet from any other
> class requires passing a reference to your servlet
> as an argument to some method in the calling class.
> Unless you do that, there's no way to acquire a
> reference to any servlet from the servlet container
> itself. That is why you should design
> shared logic and data to be in separate classes that
> you make available in the servlet context attributes
> -- these objects are available to all servlets and
> JSP pages in your application.
>
> Craig McClanahan
>
>
> >
> > Thanks ..
> > At 02:34 PM 06/22/2000 -0500, you wrote:
> > >On Thu, 22 Jun 2000, Rajesh R.Basawa wrote:
> > >
> > >> Hi all,
> > >> I have controller servlet which needs to call
> the member functions
> > >> of other servlets depending on some
> condition.(Not doGet and doPost
> > >> method). How can it be achieved.The version 2.2
> doesn't support
> > >> getServlet() method to get other servlets
> running on my webserver.
> > >
> > >Without knowing the details of your application,
> my first suggestion
> > >would be to redesign things such that those
> methods are not buried in
> > >a particular servlet -- sounds like they should
> be in a different
> > >class, one that's not a servlet and is accessible
> from your servlets.
> > >Remember, servlets are only part of the
> application, they handle the
> > >request/response web interface to it (that's a
> good design principle,
> > >at least).
> > >
> > >Milt Epstein
> > >Research Programmer
> > >Software/Systems Development Group
> > >Computing and Communications Services Office
> (CCSO)
> > >University of Illinois at Urbana-Champaign (UIUC)
> > >[EMAIL PROTECTED]
> > >
> >
>
>___________________________________________________________________________
> > >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
> > >
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Rajesh Basawa
> > Professional Services, Cisco Systems, Inc.
> > Voice: 408-853 9557
> > Email: [EMAIL PROTECTED]
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> >
>
___________________________________________________________________________
> > 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
>
>
___________________________________________________________________________
> 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
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
___________________________________________________________________________
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