• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Jsp Custom Tag

Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai all

i want to create JSP custom tag of my own. Pls any one tell me how to create JSP custom tag. If possible pls give be code and pls explain it. So that i can learn

Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Custom tags are covered in the J2EE tutorial... what would you like to do with your tags? We could probably supply some pointers...
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code will help you to write custom tags :

tld file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">;

tag class

package org.custom.tags;

import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspException;

public class TextField extends TagSupport{

private String strProperty = null;

public void setProperty(String property){
this.strProperty = property;

public String getProperty(){
return this.strProperty;

public int doStartTag(){
JspWriter outStream = pageContext.getOut();
outStream.println("<input type='text'>");
}catch(Exception exception){
return EVAL_PAGE;


jsp file
<%@ page import="java.util.ArrayList"%>

<%@ taglib uri="/tags/custom-html" prefix="html" %>

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
<table width="100%">



sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic