• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to print the output on browser

 
Jyothirmai Vissapragada
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try response.setContentType("text/html")
 
Jyothirmai Vissapragada
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply. It worked now.

Have a good day!!!

Jyothi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic