Thread: Important JSP tags
Threaded View
-
12-10-2008 09:12 PM #1New Member
- Join Date
- Dec 2008
- Posts
- 2
Important JSP tags
These types of tags are used primarily to import packages. Altenatively you can also use these tags to define error handling pages and for session information of JSP page.
1. Directives
These types of tags are used primarily to import packages. Altenatively you can also use these tags to define error handling pages and for session information of JSP page.
a- <%@page language="java" %>
b- <%@page language="java" session="true" %>
c- <%@page language="java" session="true" errorPage="error.jsp" %>
e- <%@page language="java" import="java.sql.*, java.util.*" %>
f- <%@ include file="/title.jsp"%>
2. Declarations
JSP declarations starts with '<%!' and ends with '%>'. In this you can make declarions such as int i = 1, double pi = 3.1415 etc. If needed, you can also write Java code inside declarations.
Example 1
Code: JSP
<%!
int radius = 7;
double pi = 3.1415;
%>
Example 2
Code: JSP
<%!
double radius = 7;
double pi = 3.1415;
double area()
{
return pi*radius*radius;
}
%>
3. Scriptlets
JSP Scriptlets starts with '<%' and ends with '%>'. This is where the important Java code for JSP page is written.
Example
Code: JSP
<%
String id, name, dob, email, address;
id = request.getParameter("id");
name = request.getParameter("name");
dob = request.getParameter("dob");
email = request.getParameter("email");
address = request.getParameter("address");
sessionEJB.addClient(id, name, dob, email, address);
%>
request, response, session and out are the variables available in scriptlets.Last edited by Aswany; 12-10-2008 at 09:15 PM.
Similar Threads
-
Important changes in Parking pay
By 2fly1 in forum Domain DiscussionsReplies: 0Last Post: 06-05-2007, 04:30 PM -
Which is most important?
By Gayble in forum General ChatroomReplies: 11Last Post: 11-01-2005, 09:09 PM -
Important: Please read.
By jon in forum Members LoungeReplies: 3Last Post: 08-28-2005, 06:57 AM


LinkBack URL
About LinkBacks




Reply With Quote