views:

19

answers:

1

I'm working as a front-end developer on an old jsp-based cms that is no longer supported by our vendor. At the beginning of a certain page template, the html document starts with:

<!%@ include file = "setCookie.jsp" %>

This will always be the first line of the file. The display is not an issue in Firefox, but IE tweaks out. I've tried starting my page template with closing jsp comments, ending , redeclaring the doctype, etc. But I can't seem to correct the issue IE is having.

Please see the broken display of the page here: http://i.imgur.com/iRTRW.gif

Here is what the layout of the page looks like without the jsp comment: southland.geigerstores.com

Any solutions? Or can you explain to me why IE behaves this way?

+1  A: 

In IE, if the <!DOCTYPE> is not on the very first line of the HTML document (if there's any whitespace before it), it will often put your document into Quirks Mode.

Looking at the source of your page, there are a bunch of blank lines present before the <!DOCTYPE>. In JSPs, this is usually caused by JSP tags that have newlines after them. Although the tags themselves aren't rendered, the newlines still are.

Either put the <!DOCTYPE> as the very first line in your JSP, or make sure there are no newlines before it. E.g.

<!%@ include file = "setCookie.jsp" 
%><!DOCTYPE .....>

or

<!DOCTYPE .....>
<!%@ include file = "setCookie.jsp" %>

rather than

<!%@ include file = "setCookie.jsp" %>
<!DOCTYPE .....>
jimr