When I ‘view source’ using different browsers my web pages seems to always have lots of whitespace and are badly formatted. I am developing a Java web application using JSPs.
How can I ensure that when I ‘view source’ I see nicely formatted HTML?
Edit:
When I say formatted I mean typically:
I get this kind of thing:
<div>
<p>some text</p>
</div>
when I want:
<div>
<p>some text</p>
</div>
In my JSPs (which use includes) everything is formatted nicely.
View Source is only going to show whatever the page gives it in browsers that I know of, so if the HTML isn’t formatted nicely, you won’t see it formatted nicely.
Your best bet would be to use the developer tools in whatever browser you are in. The HTML is normally structed nicely in there when viewing the HTML. In Chrome or Internet Explorer, F12 should open the developer tools and I think F12 opens Firebug in Firefox if you have it installed.
Note: The source/HTML elements typically viewed by developer tools isn’t exactly what the page spits out. They often show dynamic elements that were added through script and/or plugins.