Jsp , javasportal, jsp basic,


Published on

Published in: Education, Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Jsp , javasportal, jsp basic,

  1. 1. By: Sanghavi Infosoft Pvt. Ltd.
  2. 2. In JSP, special tags are used to embed dynamic content generation code into a HTML page. Following types of tags are used in JSP: 1. Scriptlet Tag 2. Declaration Tag 3. Expression Tag 4. Directive Tag 5. Action Tag 
  3. 3.  All the statements which are placed within scriptlets are moved to _jspService() method with Auto Generated Servlet at the time of translation. Syntax-
  4. 4.  Within a scriptlet following implicit objects are made available to a JSP programmer: * represents, is not available by default in all JSP pages.
  5. 5.  This tag is used to define data members & methods in the Auto Generated Servlet. Syntax- <%! %> datamember & method definition
  6. 6.  This tag is used to write a String or String returning expression to the Output Stream. In other words, this tag provides a shorthand mechanism of writing strings or String returning expressions to output stream. Example-
  7. 7. $
  8. 8.  Directives Tags are used to provide information to the JSP translator. This information is used by the translator at the time of creating Servlet from the JSP.
  9. 9. There are 3 types of directives in JSP: 1. page directive 2. include directive 3. taglib directive 
  10. 10.  This directive is used to provide information such as base class for Auto Generated Servlet, packages to be imported, content type to be set, URL of error handler page etc. Syntax<%@ page attribute=“value” %>
  11. 11.  This directive is used to include the contents of a resource to the response of current JSP. Syntax<%@ include file=”URL of Resource” %> $
  12. 12.  taglib directive is used to specify the location of a TLD (Tag Library Descriptor) file that defines many tags. Syntax<%@ taglib uri=“uniqueIdentifier/path of tld file” prefix=“prefixOfTagLibrary” %> Example<%@ taglib uri=“http://www.rupendra.co.cc/tags” prefix=“mytag” %> Note: We will use this tag in custom tag section so it will be better to learn it in custom tag.
  13. 13.   This tag is used to generate code within _jspService() method for performing some action such as creating an object, setting its properties, including the contents of the resource, forwarding the request to another resource, etc. The action tags basically are used to control the flow between pages and to use java beans.
  14. 14. 1. 2. 3. 4. 5. 6. 7. <jsp:forward> <jsp:include> <jsp:useBean> <jsp:setProperty> <jsp:getProperty> <jsp:param> etc.
  15. 15.  The <jsp:forward> action tag is used to forward the request to another resource it may be jsp, html or another resource. $
  16. 16.  The <jsp:include> action tag is used to include the content of another resource it may be jsp, HTML or Servlet. Advantage of <jsp:include> action tag: 1. Code reusability $