This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Not able to print the output on browser
 
Similar Threads
Starting out on Servlets - from Head First Servlets and JSP
404 error is coming after submiting the form how to resolve it
error with mvc application
servlet programming problem in Eclipse
Why this EL code part is not working