Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javasevlet basic question

Status
Not open for further replies.

786snow

Programmer
Nov 12, 2006
75
0
0
Hi,
In my Javasevlet I am creating the following html, but when I hit the sevlet with brower instead of printing only "whats up", i see the whole string
"<html><body><h1>whats up</h1></body></html>"

********************

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out = res.getWriter();
out.println("<html><body><h1>whats up</h1></body></html>");


}

I don't know why?
 
Before writing out, add :

res.setContentType("text/html");

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top