aspose file tools*
The moose likes Servlets and the fly likes question from Head First JSP Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "question from Head First JSP Servlets" Watch "question from Head First JSP Servlets" New topic
Author

question from Head First JSP Servlets

Hk mingham
Greenhorn

Joined: Oct 16, 2010
Posts: 4
in this book ,on page 131,it said "Q: Why do you have to set the content type? Can’t servers figure it out from the extension of the file? A:But we’re talking about what happens inside a servlet where there IS no file! You’re the one who is sending back the response; the Container has no idea what you’re sending."

how strange,he said "the Container has no idea what you’re sending",but,now ,we are building the whole web app,we can handle everything,the container can know the type after we built it,we aren't client,we are developer,why it said the container don't know?
Joshi Nirav
Greenhorn

Joined: Dec 04, 2009
Posts: 14

Hi,
I think in the book the statement was written in the context of the response and response type that would suppose to be written on the output stream an we need to tell the server that " Hey here my content and its type sending to wards our client who will request to our page ." because ultimately developer who will developing that page need to informe to server about the content.content type.

He said that container wont' know because after the execution/interpretation of the page code container will get the content/content type.


Thanks and Regards
Nirav Joshi
Hk mingham
Greenhorn

Joined: Oct 16, 2010
Posts: 4
Joshi Nirav wrote:Hi,
I think in the book the statement was written in the context of the response and response type that would suppose to be written on the output stream an we need to tell the server that " Hey here my content and its type sending to wards our client who will request to our page ." because ultimately developer who will developing that page need to informe to server about the content.content type.

He said that container wont' know because after the execution/interpretation of the page code container will get the content/content type.


Thanks and Regards
Nirav Joshi




Nirav Joshi ,totally thanks for your answer,this is the first time i ask question in javaranch,i glad that i can get the answer in such short time and such great answer.all i should say is thanks Nirav Joshi.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: question from Head First JSP Servlets