JSP Vs Servlet
Now a days when we are no longer content with just seeing static html content , so we have started using java to develop dynamic web pages .Java Servlet is a program that is run on the server to provide dynamic pages. Later we saw java releasing JSP(Java Server Pages) as a more flexible scripting alternative to Java Servlets.
Since Java Servlets are java programs therefore they are already compiled . So they respond faster.
Whereas JSP is a scripting language so it has to be interpretted line by line , which makes it slow.
But still we as programmers like to use JSP because it is light weight scripting language , easy to code in and much more flexible than java Servlet programming language which adheres to very strict programming guidelines .
So then what can be done about the speed?
Servlets were faster than JSP(Java Server Pages) in terms of provide response.
So here comes Tomcat Web Server into picture.
Web developers create JSP(Flexible and lightweight and easy to create) pages and translate them into Servlets by Tomcat .
Points to remember:
1. JSP is a webpage scripting language that can generate dynamic contents .
2. It’s easier to code in JSP than in Java
3. Servlets are Java programs that can too generate dynamic contents .
4. JSP are interpreted.
5. Servlets are already compiled
6. Therefore Servlets run faster compared to JSP
7. JSP can be compiled into Java Servlets by Tomcat Web Server
8. JSP and Java Servlets are usually used in conjunction nowadays
Links to useful posts:
· Abstraction
Comments