Wednesday, January 21, 2015

Introduction to JSP



JavaServer Pages — JSP is a Java based technology that is used to develop dynamic web sites. With JSP, web designers and developers can quickly incorporate dynamic elements into web pages using embedded Java and markup tags. These tags provide the HTML designer with a way to access data and business logic stored inside Java objects

The following figure shows the process of the flow of events that occur after a client 
requests for a JSP page





Once a JSP is translated to a servlet, the container invokes the following life cycle methods on the servlet that are defined in the javax.servlet.jsp.JspPage interface:
Various types of JSP scripting

Declaration

These statements are placed between <%! and  %> symbols and always ends with a semicolon.
Ex-
<%!
Int a = 0;
Int b = 5;
%>

Expressions

This is used to include a jsp expression in a jsp file, the expression is included inside the <%= and %> symbols.
Ex-
<%= new java.util.date() %>

Scriptlets

The syntax to declare JSP scriptlets to include valid Java code <% java code %>

No comments:

Post a Comment