tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject [OFF-TOPIC] RE: RequestDispatcher include() Problem
Date Thu, 10 Apr 2003 18:38:12 GMT

Howdy,
There are many ways to do this, but from the subject of your message I
gather you're interested in the RequestDispatcher approach.  Consider
the following setup:

- HeaderServlet is a servlet you wrote which generates the header, and
is mapped to /GetPageHeader in your web.xml
- FooterServlet is a servlet you wrote which generated the footer, and
is mapped to /GetPageFooter in your web.xml
- MainServlet is a servlet you wrote which generates the body, including
the header and footer.

In MainServlet's doGet() (or doPost, or whatever), which has
HttpServletRequrest req and HttpServletResponse res as parameters, you
would do:

RequestDispatcher rd =
getServletContext().getRequestDispatcher("/GetPageHeader");
rd.include(req, res);

// output the body here

rd = getServletContext().getRequesDispatcher("/GetPageFooter");
rd.include(res, res);

// That's it.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Lior Shliechkorn [mailto:liorshliech@yahoo.com]
>Sent: Thursday, April 10, 2003 2:24 PM
>To: Tomcat
>Subject: RequestDispatcher include() Problem
>
>
>Hi,
>
>I know this is off topic for this discussion forum, but I hope you who
are
>reading this would be able to help regarding this matter. I'm trying to
>include the header and footer of a page and pass them to a servlet. But
I'm
>not sure how this works, and how to get the data objects that are
included
>and sent to the servlet.
>
>Any help is greatly appreciated. If you can send me a code sample it
would
>be fantastic. I've looked around a lot and found nothing about the
matter.
>
>Thanks for your time,
>
>Lior
>
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! Tax Center - File online, calculators, forms, and more



This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message