Web page displays as XML -- why?

J

javaguy

I am creating a web page with Java Server Faces. When I direct a web
browser to:

http://mysite/faces/index.faces

the server emits the following text:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta content="text/html; charset=iso-8859-1"
http-equiv="Content-Type"/>
<title>Simple JSF App Login 2</title>
</head>
<body>
<form id="_id1" method="post"
action="/faces/login/index2.faces"
enctype="application/x-www-form-urlencoded">
<h3>Please enter your name and password.</h3>
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="_id1:_id2" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="_id1:_id3" value="" /></td>
</tr>
</table>
<p><input type="submit" name="_id1:_id4" value="Login" /></p>
<input type="hidden" name="_id1" value="_id1" />
</form>
</body>
</html>


When the web browser I use is non-Microsoft things are working OK. The
text is rendered as an HTML page.

When IE6 is used the text is rendered as an XML document. Not what I
need, as it is intended to be a HTML page.

If I save the source of the page to a text file and then tell IE6 to
display it the saved file displays as an HTML page! So, when I get the
text from the server I get XML. When I get the text from the file I
get HTML. I am aware that the source code IE6 shows me is from its
DOM, and not what was served up. Still, what gives?
Thanks for any help,

Jerome.
 
R

Robert Aldwinckle

....
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC
when I get the text from the server I get XML.
When I get the text from the file I get HTML.

I think more importantly you need to look at what headers
are being sent in the HTTP response and whether IE is being
asked to "sniff" the data even if it is being told what it is.

E.g., what setting are you using with the security option
Open files based on content, not the file extension

I suspect it is going to be that first header that is causing the symptom
but I don't know if that option would cause a second guess to be taken
by looking more closely at the rest of your source.

What if you *wanted* this source to be detected as XML
would it look any differently? If you want it look like HTML
I'd try deleting the XML version header.

What happens if you reverse those two headers?
(Is that legal?) Capitalize the html in the DOCTYPE header?
Etc.

You would probably get a more informed answer in a newsgroup
which specializes in web development.


HTH

Robert Aldwinckle
---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top