JSP Introduction :-


JSP is another Java Technology that provides easy and fast development of web applications. JSP is an extension of Servlet and not meant to replace Servlets. However it is a common practice to use both Servlet and JSP in your web application development according to our requirements - use JSP if a web page require more HTML then Java, and use Servlet if web page require more Java then HTML.
It is important to note that Java web container converts our JSP's into fully fledged Servlet's. When a request came in for a JSP page for the first time, web container converts JSP page into Servlets -



Note that, web container does not do any thing with JSP pages until a request came in for that, this conversion and compilation of JSP pages take place when a request came in for the first time for the particular JSP page. It is a onetime process and never happens again.

Advantages of JSP -

1- Easy to learn - If you are familiar with HTML, you can use JSP without much knowledge of Java and underlying API,s. JSP makes use of tags like HTML or XML. However if you want to be a very good java programmer, you need to know both JSP and Servlet.
2- Less coding - JSP makes use of expression language and Java standard tag library that require less code compared to Servlet.
3- Flexibility - JSP allows developer to build their own tags, that provides flexibility to developer to build and use tags according to their requirements.