Click to See Complete Forum and Search --> : why servlet generate html tags i didn't write them


ragheb.khaseeb
02-23-2009, 06:51 AM
i write html page to iframe like this
PrintWrite out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<script language=\"javascript\">");
out.println("top.frames['bridge_frame'].location = \"http://"+host+"/empty.html?message="+message+"\";");
out.println("</script>");
out.println("</head>");
out.println("<body>");
out.println("</body>");
out.println("</html>");

when i view the iframe content by Firebug the iframe contnet is
<html><head></head><body><pre></pre>top.frames['bridge_frame'].lcaotion ... </body></html>

chazzy
02-23-2009, 09:19 PM
firebug shows you the rendered dom's literal form. it can contain tags you didn't include.

ragheb.khaseeb
02-24-2009, 08:24 AM
Thank you chazzy

it solved by two solutions, the first is using setContentType which is disabling flush() function, i was needing to flush therefore i didn't use it
and the other, i re configured default type to text/html instead of text/plain

the second solution will add content-type: text/html to the browser header