----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------


Hi,

In JSDK 2.1 RequestDispatcher is used to invoke a new servlet with the same
request object that was received by the original servlet. If that is what
you need to do in JSDK 2.0, then you have to do:

SomeServlet srv = (SomeServlet)
getServletConfig().getServletContext().getServlet("/SomeServlet");

You can then invoke a method in the servlet, like:

srv.blah(request, response);

Note, however, that this method is deprecated in JSDK 2.1 onwards, so if you
use it, you will need to change it to the requestdispatcher method whenever
you switch to Tomcat (which uses JSDK 2.1).

Also note that you have to know the type of the servlet that you are calling
- can't call just any servlet - unless you use reflection. Here at my
company I wrote a 'base' servlet that uses reflection to call any number of
other servlets when it is done with its own processing. All our servlets
inherit this ability. What this allows us to do is that if we have a big
form, multiple servlets can act on that form, each consuming only the form
elements it is interested in. Works out in a pretty nice way.

Regards,
naeem

> -----Original Message-----
> From: Phil Smy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 16, 2000 4:20 AM
> To: 'Java Apache Users'
> Subject: RE: getRequestDispatcher??
> 
> 
> ----------------------------------------------------------------
> BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> WHEN YOU POST, include all relevant version numbers, log files,
> and configuration files.  Don't make us guess your problem!!!
> ----------------------------------------------------------------
> 
> ok...sounds possible! Now, any ideas on loading pages then? 
> The examples I
> find all seem to use requestdispatchers in this manner!
> 
> Phil
> -------------
> Phil Smy, VNU Publitec
> phone:  31-20-567-6704
> fax:    31-20-691-0374
> 
> 
> -----Original Message-----
> From: Andras Balogh [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 16, 2000 11:20 AM
> To: Java Apache Users
> Subject: Re: getRequestDispatcher??
> 
> Hi,
> 
> I am not sure but i think because JSDK20 doesn't support this.
> You have to redesign your servlet because JSERV supports only
> this version of JSDK.
> 
> p.s. If it compiles it means that on your develpoment machine you have
> JSDK2.1 or higher. Downgrade. :)
> 
> Best wishes,
>                  Andras.
> ----- Original Message -----
> From: Phil Smy <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 16, 2000 11:08 AM
> Subject: getRequestDispatcher??
> 
> > I am sure that I am doing something wrong, but, looking 
> through the faq
> and
> > archives and not finding anything I am resorting to this noise! :-)
> >
> > Anyway, I am trying to have a servlet launch / load a jsp 
> page. Both jsp
> > pages and Servlets work fine in my setup.
> >
> > The code is like this in the servlet:
> >
> > ServletContext sc = getServletContext();
> > RequestDispatcher rd = sc.getRequestDispatcher("/snoop.jsp");
> > rd.forward(req, res);
> >
> > it compiles fine, but, running I get this in the jserv.log:
> > [15/02/2000 13:05:43:456 CET] java.lang.AbstractMethodError:
> > org/apache/jserv/JServContext.getRequestDispatcher
> > at
> > 
> org.apache.jserv.JServConnection.processRequest(JServConnectio
> n.java:320)
> > at org.apache.jserv.JServConnection.run(JServConnection.java:188)
> > at java.lang.Thread.run(Thread.java:479)
> >
> > Any ideas? Is this because of a problem, perhaps between 
> what version of
> the
> > Sun stuff I have (too new?). Comments / pointers to 
> comments would be
> > greatly appreciated.
> >
> > Thanks from a first-time poster!
> >
> > Phil
> 
> 
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]
> 


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to