JSP - SPLessons

Chapter 2

JSP Overview

JSP Overview

JSP Overview, The chapter demonstrates about JSP Overview. JSP contains both Java and HTML in the same file. JSP is same like HTML, but the difference in JSP developer writes Java code with script tags. JSP can be easily managed because business logic is separated from presentation logic. But in Servlet technology, both will be mixed up. When JSP page is updated, there is no need to recompile and redeploy the project. Following are the packages will be used by JSP.


Elements of JSP

JSP Overview, JSP will have elements, these elements are the backbone to the JSP, every JSP code will be combined with these elements. Following are the important assets of JSP.

Following are the Scripting Elements.


Following is an example by using scriptlet tag.

<html>  
<body>  
<% out.print(4*5); %>  
</body>  
</html> 

Now compile this code output will be 20.
Following are the Implicit Objects.


Following are the Directive Elements.

Following are the Action Elements.

Summary

  • JSP Overview – Implict objects can be also called as pre defined variables.
  • JSP Overview – The Less code will be written in JSP compared to servlet that is the main advantage of JSP.
  • JSP Overview – Web container contains both JSP and Servlet containers.