Thursday, 12 February 2015

11. Write a JAVA JSP Program which implements nested tags and also use TagSupport Class


 index.jsp  
<%@taglib prefix="d" uri="/WEB-INF/tlds/abcd.tld"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<d:tag1>
<c:out value="this is inner tag"></c:out>
</d:tag1>
</body>
</html>
--------------------------------
tag1.java
package mytag;
import java.io.*;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
public class tag1 extends TagSupport
{
public int dostartTag() throws JspException
{
try
{
pageContext.getOut().write("hello dis is inside customer tag class");
}
catch(IOException e)
{
throw new JspException("Error");
}
return EVAL_BODY_INCLUDE;
}
}

No comments:

Post a Comment