Define JSP Explain the different types of JSP tags by taking suitable examples

The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we solve previous year question papers for you.
See Our team
Wondering how we keep quality?
Got unsolved questions?

Ask Questions

Hey, We have just launched eduladder videos.Looking for creators and contributors Read Guideline
Java-10cs753-Downloadable-->View question

Define JSP Explain the different types of JSP tags by taking suitable examples?

(10 Marks) [Jan 2014, July 2013 , Jan 2012 Jan 2015]


Taged users:

Be first to like this question

Be first to dislike this question

Talk about thisDelete|Like|Dislike|


In JSP tags can be divided into 4 different types.

These are:

Directives: In the directives we can import packages, define error handling pages or the session information of the JSP page.

Declarations: This tag is used for defining the functions and variables to be used in the JSP.

Scriplets: In this tag we can insert any amount of valid java code and these codes are placed in _jspService method by the JSP engine.

Expressions: We can use this tag to output any data on the generated page. These data are automatically converted to string and printed on the output stream.

Syntax of JSP directives is:

<%@directive attribute="value" %>

Where directive may be: page: page is used to provide the information about it. Example: <%@page language="java" %>

include: include is used to include a file in the JSP page. Example: <%@ include file="/header.jsp" %>

taglib: taglib is used to use the custom tags in the JSP pages (custom tags allows us to defined our own tags).Example: <%@ taglib uri="tlds/taglib.tld" prefix="mytag" %> and attribute may be:

language="java"This tells the server that the page is using the java language. Current JSP specification supports only java language. Example: <%@page language="java" %>

extends="mypackage.myclass" This attribute is used when we want to extend any class. We can use comma(,) to import more than one packages. Example: <%@page language="java" import="java.sql.*,mypackage.myclass" %>

session="true" When this value is true session data is available to the JSP page otherwise not. By default this value is true. Example:<%@pagelanguage="java"session="true" %>

errorPage="error.jsp" errorPage is used to handle the un-handled exceptions in the page. Example: <%@page language="java" session="true" errorPage="error.jsp" %>

contentType="text/html;charset=ISO-8859-1" Use this attribute to set the mime type and character set of the JSP. Example: <%@page language="java" session="true" contentType="text/html;charset=ISO-8859-1" %>


Be first to like this answer

Be first to dislike this answer
Talk about this|Once you have earned teacher badge you can edit this questionDelete|Like|Dislike|

Can you help us to add better answer here? Please see this

Not the answer you're looking for? Browse other questions from this Question paper or ask your own question.

Join eduladder!