Main elements of a JSP
by, 01-01-2012 at 06:54 PM (1227 Views)
In a JSP page, two types of data are present.
• Static part (ie CSS, HTML etc), that is copied to the response directly by the JSP Engine.
• Dynamic part that consists of anything which can be compiled and translated by the JSP Engine.
Dynamic elements consist of 3 elements.
• Scripting Elements: A JSP element which gives out the embedded Java statements. Three kinds of scripting elements are present.
o Declaration Element: is considered to be the “embedded Java declaration statement” that is inserted at the “Servlet class level.”
o Expression Element: is that embedded Java expression that is evaluated by help of service method.
o Scriptlet Elements: are those embedded Java statements that are executed as service method’s part.
• Action Elements: For execution phase, a JSP element which gives the information.Java Code: This is the java code to get a request parameter<% //Java codes String userName=null; userName=request.getParameter("userName"); %>
• Directive Elements: For the translation phase, a JSP element which gives the global informationJava Code: This is the jsp element which gives information<jsp:useBean id="object_name" class="class_name"/> <jsp:include page="scripts/login.jsp" />
Java Code: This is the jsp tags that provide global information<%@ page import=”java.util.Date” %> <%@ include file=”myJSP” %> <%@ taglib uri=”tagliburi” prefix=”myTag”%>