File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Doubts regarding request and response objects. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Doubts regarding request and response objects." Watch "Doubts regarding request and response objects." New topic
Author

Doubts regarding request and response objects.

Aashima Arora
Ranch Hand

Joined: Jun 15, 2010
Posts: 59

Hi,
Iam having some confusions..

Iam having these to servlets, what iam doing is to try to include the output of another servlet into my servlet.
FirstServlet : In which the output of SecondServlet is to be included.

FIRST SERVLET




SECOND SERVLET




Doubts:

1. what do the request and response objects contain in the rd.include(request,response); i tried request.toString() and response.toString(). though am sure that request is obviously the GET request for the first servlet but dont know what the response object contains.
2.Iam not able to understand the way we sent request parameters. like " ?myname=aashima",i mean it is the path ,so can we just pass the information as a
query string appended to the destination URL.
3.and am sorry about the weirdest confusion. what does the response.setContentType("text/html") do. i mean in the second servlet when we write
out.println(attribute+ ":" + request.getAttribute(attribute)+"<BR>"); we have no opening tags (out.println("<html">) and likewise no closing tags. so we can use it this way?


i have just started the preparation so my basics are not clear but am trying. would be great if you guys help

Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Hi Aashima, you don't use Servlets in the OCMJD - maybe you meant to post in another forum? The guys in this forum here might be better positioned to help you Web Component Certification (SCWCD/OCPJWCD).


SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2267
    
    3

Sean Keane wrote:Hi Aashima, you don't use Servlets in the OCMJD - maybe you meant to post in another forum?


Absolutely! Let's slide this over to the Servlets forum!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Aashima Arora
Ranch Hand

Joined: Jun 15, 2010
Posts: 59

oh iam very sorry ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubts regarding request and response objects.