May sound a stupid statement but what surprised me it came from a well educated java professional. He argued:
“JSP is HTML. Take a look at some decent jsp/servlet applications, and you will see that over 90% of your jsp file is html.”
According to him since JSP pages contain a lot of HTML, so JSP is HTML. Then he continued
“Decent jsp files are basic html expanded with some additional tags and el functions.”
I am awed with these statements. Am I missing something?
IMHO the generalization that “JSP is HTML” goes a bit too far.
I agree that, for the most part, JSP files will have a lot of html in them, but that is just because most http request that users make are for html files (which afterwards make their own requests for images, scripts, etc…).
If everyone started making requests for lisp files then most JSP files would be full of parenthesis, but the JSP technology in itself would remain the same.
And of course, most additional tags and el functions deal with HTML related stuff just because that is what most usefull to most developers.
In theory, whatever content types the browser sets in the accept header of the request, you should be able to respond with a JSP. Have a look at this example: http://code.google.com/p/json-simple/wiki/JSPAndAJAXExamples
Furthermore, one must realize the truth: at runtime, there is no JSP. Then you will see that it is not the JSP that writes HTML into the response, it is only Java.
This is because all JSPs are compiled (or ideally precompiled) into Java servlets that reverse what you have written in the JSP file and write that content into a stream. So in this respect a JSP is much more a piece of Java code than an HTML file…
As for the rest of the conversation going on about what is valid html, css and validation, it’s just a big red herring.
My two cents.