aspose file tools*
The moose likes Servlets and the fly likes Not able to print the output on browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Not able to print the output on browser" Watch "Not able to print the output on browser" New topic
Author

Not able to print the output on browser

Jyothirmai Vissapragada
Greenhorn

Joined: Sep 22, 2006
Posts: 4
Hi,

I am preparing for SCWCD exam. I am following Kathy Sierra's textbook - Head First Servlets and JSPs.

I am practicing the programs given in the text book for better understanding. There is a program in chapter-3, where the user will select one of the items (coffee/beer color) from the drop down menu which is a HTML file. Now, based on the user selection, the servlet should give some suggetions that which kind of beer/coffee brands the user may want to try.

Everything is working fine for me except, after the user selects the item and hits the button, there is a file getting created on my machine to which the suggested brands are getting written. I am not able to understand why is it happening. I want the output (brand suggestions) to be displayed on the browser window. Please let me know how can I fix it and what is going to wrong.

Below, I attached my HTML and Servlet codes.



My servlet's doGet() and doPost() looks like this:



Thank you.

KiranJyothi
DaslanJ Govender
Greenhorn

Joined: Jul 25, 2007
Posts: 6
try response.setContentType("text/html")
Jyothirmai Vissapragada
Greenhorn

Joined: Sep 22, 2006
Posts: 4
Hi,

Thanks for the reply. It worked now.

Have a good day!!!

Jyothi
 
 
subject: Not able to print the output on browser