Results 1 to 1 of 1

Threaded View

  1. #1
    New Member Aswany is on a distinguished road
    Join Date
    Dec 2008
    Posts
    2

    Default 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

  1. Important changes in Parking pay
    By 2fly1 in forum Domain Discussions
    Replies: 0
    Last Post: 06-05-2007, 04:30 PM
  2. Which is most important?
    By Gayble in forum General Chatroom
    Replies: 11
    Last Post: 11-01-2005, 09:09 PM
  3. Important: Please read.
    By jon in forum Members Lounge
    Replies: 3
    Last Post: 08-28-2005, 06:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts