Friday, 2 February 2018

JSP Custom Tag

custom tag in jsp, how to define custom tag in jsp, process to create custom tag in jsp,what is custom tag, what are different way to define custom tag,

Custom tags are user-defined tags. They eliminates the possibility of scriptlet tag and separates the business logic from the JSP page.

Advantages of Custom Tags

The key advantages of Custom tags are as follows:
  1. Eliminates the need of scriptlet tag The custom tags eliminates the need of scriptlet tag which is considered bad programming approach in JSP.
  2. Separation of business logic from JSP The custom tags separate the the business logic from the JSP page so that it may be easy to maintain.
  3. Re-usability The custom tags makes the possibility to reuse the same business logic again and again.

Syntax to use custom tag

There are two ways to use the custom tag. They are given below:


<prefix:tagname attr1=value1....attrn=valuen />  



<prefix:tagname attr1=value1....attrn=valuen >  
body code  
</prefix:tagname>  


For creating any custom tag, we need to follow following steps:
ü  Create the Tag handler class and perform action at the start or at the end of the tag.
ü  Create the Tag Library Descriptor (TLD) file and define tags
ü  Create the JSP file that uses the Custom tag defined in the TLD file




DashZin

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comments:

Post a Comment