Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Servlets
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
Servlets
PrintWriter no html to response
Grace Green
Ranch Hand
Posts: 79
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I cannot understand why the following code does not write the HTML to response.
the debugger executes each line, no errors, but no html to the response either. ANy suggestions on how to troubleshoot this ? Thank you
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); /* * Write the HTML to the response */ out.println("<html>"); out.println("<head>"); out.println("<title> A very simple servlet example</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>HELLO HELLO</h1>"); out.println("</body>"); out.println("</html>"); out.close(); }
Bear Bibeault
Sheriff
Posts: 67637
173
I like...
posted 11 years ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
Did you open the writer? (Answer: no).
If you didn't open it, you shouldn't close it.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Servlet not being called
about sendRedirect
Servlet HelloWorld problem
Java Servlets and JSP pages
java.servlet.* cannot import, but javax.servlet.* ok???
More...