With JSP pages, Java technology code fragments are embedded in an HTML-like file. This code is executed at runtime to create dynamic content.
All template page technologies have the same fundamental structure: an HTML page that a Web designer can easily create, with special tags, which indicate to the Web server that code needs to be executed at request-time.
JSP pages are the opposite of servlets. Instead of Java technology code that contains HTML, template pages are HTML that contains Java technology code. JSP pages are converted by the Web container into a servlet instance. That servlet then processes each request to that JSP page. This feature of JSP pages is an advantage over other template page technologies because JSP pages are compiled into Java technology byte code whereas ASP (or PHP) pages are interpreted on each HTTP request.
The JSP page runs as a servlet; everything that you can do in a servlet you can do in a JSP page. The main difference is that a JSP page should focus on the presentation logic of the Web application
Because JSP pages are translated into Java servlets, JSP technology has all of the advantages of servlets:
- Web applications using JSP pages have high performance and scalability because threads are used rather than operating system's shells or processes.
- JSP technology is built on Java technology, so it is platform independent.
- JSP scripting elements can be written in the Java language so that JSP pages can take advantage of the object-oriented language and all of its APIs.

