View RSS Feed

JSP

Main elements of a JSP

Rate this Entry
by
JSP
, 01-01-2012 at 05:54 PM (1387 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.

Java Code: This is the java code to get a request parameter
<%
//Java codes
String userName=null;
userName=request.getParameter("userName");
%>
• Action Elements: For execution phase, a JSP element which gives the information.

Java Code: This is the jsp element which gives information
<jsp:useBean id="object_name" class="class_name"/>
<jsp:include page="scripts/login.jsp" />
• Directive Elements: For the translation phase, a JSP element which gives the global information

Java Code: This is the jsp tags that provide global information
<%@ page import=”java.util.Date” %>
<%@ include file=”myJSP” %>
<%@ taglib uri=”tagliburi” prefix=”myTag”%>

Submit "Main elements of a JSP" to Facebook Submit "Main elements of a JSP" to Digg Submit "Main elements of a JSP" to del.icio.us Submit "Main elements of a JSP" to StumbleUpon Submit "Main elements of a JSP" to Google

Updated 01-14-2012 at 06:04 PM by JSP

Categories
Tutorial

Comments