JSP vs HTML. JSP and HTML both support tag-based programming but there are lots of differences between HTML and JSP.
The JSP represents Jakarta Server Pages (formerly Java Server Pages), and contains .jsp, .jspx, .jspf file extensions. It was given by Sun Microsystem (now Oracle) in 1999. It is Java-based server-side web technology used to generate dynamic web pages. We can place Java and all client-side technology code including HTML in the JSP file.
Key Differences between HTML and JSP (JSP vs HTML)
|It was given by W3C in 1993.||It was given by Sun Microsystem in 1999.|
|It is client-side web technology.||It is Java-based server-side web technology.|
|HTML is used to generate static web pages.||JSP is used to generate dynamic web pages.|
|To execute HTML code we need an HTML interpreter.||To execute the JSP code we need a JSP container or JSP engine.|
|HTML code is not strictly typed.||JSP code is strictly typed.|
|HTML tags are not case-sensitive.||JSP tags are case-sensitive.|
|Custom HTML tag creation is not possible.||Custom JSP tags development is possible.|
|We can’t place Java code in an HTML file.||We can place Java code in a JSP file.|
|We can’t place JSP code in an HTML file.||We can place HTML code in a JSP file.|
HTML code is not strictly typed but JSP is strictly typed therefore in a JSP file, every open tag must have a closing tag in the order they are defined. Unlike HTML, the JSP is case sensitive therefore uppercase and lowercase characters are treated differently.
Sample of HTML and JSP File
Sample of HTML file (test.html),
<!DOCTYPE html> <html> <head> <title>Welcome</title> </head> <body> <h1 style="color:blue; text-align:center"> Welcome to HTML</h1> </body> </html>
Sample of JSP file (test.jsp),
<h1 style="color:green; text-align:center"> Welcome to Java server pages </h1> <br> <b> date and time :: </b> <% java.util.Date d = new java.util.Date(); out.println(d); %> <br> end of JSP
Comments in HTML vs JSP
In HTML comment is placed using
<!-- --> tags. Whereas in the JSP file, the comment is placed using
<%-- --%> tags.
<%-- Example of JSP comment --%> <!-- Example of HTML comment -->
If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or do you find anything incorrect? Let us know in the comments. Thank you!