This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes simple tag handler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "simple tag handler" Watch "simple tag handler" New topic
Author

simple tag handler

sai kunala
Greenhorn

Joined: Feb 25, 2008
Posts: 1
Hi All,

I wrote a simple tag handler

When i try to compile the jsp it saying unable to load the taghandlerclass

Im using NetBeans IDE 6.0

Please help me solve the issue.

My tagHandlerclass is as follows it is located in the src pacakge


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


public class NewTagHandler1 extends SimpleTagSupport {


public void doTag() throws JspException {

JspWriter out=getJspContext().getOut();

try {

out.print("Thisis the simple tag handler");
JspFragment f=getJspBody();
if (f != null) f.invoke(out);



} catch (java.io.IOException ex) {
throw new JspException(ex.getMessage());
}

}
}
............................................................................

My tld is as follows


<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
<tlib-version>1.0</tlib-version>
<short-name>tld2</short-name>
<uri>WEB-INF/tlds/tld2</uri>


<tag>
<name>NewTagHandler1</name>
<tag-class>NewTagHandler1</tag-class>
<body-content>scriptless</body-content>
</tag>
</taglib>

..........................................................................

My Jsp is as follows located in WEB-INF

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="hi" uri="WEB-INF/tlds/tld2.tld" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>

<hi:NewTagHandler1>
Hi thisis a sample jsp
</hi:NewTagHandler1>

</body>
</html>


Thanks and Regards

Aparna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: simple tag handler
 
Similar Threads
cannot find the declaration of element taglib
Tag Library Decriptor Problem
Error
Custom tags Problem
tld file not found