aspose file tools*
The moose likes JSP and the fly likes jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp" Watch "jsp" New topic
Author

jsp

ram shyam ravi
Greenhorn

Joined: Sep 20, 2002
Posts: 14
Hi
Pls go through the foll code.
Iam creating a custom defined tag and calling in my JSP.
The taglibclass
import javax.servlet.jsp.*;
import javax.servlet.*;
public class taglibclass extends javax.servlet.jsp.tagext.TagSupport
{
public int doStartTag() throws JspException
{
return 1;
}
}
The .tld file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd" >
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>examples</shortname>
<uri>/Web-inf/classes</uri>
<info>An example tag library</info>
<tag>
<name>size</name>
<tagclass>taglibclass</tagclass>
<info>Works out how large a file, pointed to by a URI, is in bytes</info>
</tag>
</taglib>
And web.xml file
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>

<taglib>
<taglib-uri>
/Web-inf/classes
</taglib-uri>
<taglib-location>
/Web-inf/test.tld
</taglib-location>
</taglib>
</web-app>

The JSP file where iam calling custom tag
<html>
<%@ taglib uri="/Web-inf/classes" prefix="examples" %>
<body>
</body>
</html>
With out defining the tag itself its not recognising the uri.
I have set the docroot for weblogic as myserver/servletclasses and i have created this web-inf dir in that and kept taglib class file in classes dir of web-inf dir.And i kept web.xml,.tld files in web-inf dir.And JSP file in myserver/servletclasses dir.
Pls correct my code..
bye
Rgds
Ravi Vunnam.
Rick Hightower
Author
Ranch Hand

Joined: Feb 20, 2002
Posts: 350
I can see about 5 things wrong with your listing without even trying very hard.
I suggest getting a book on how to create Custom tags or going through Sun's TagLib tutorial.


Rick Hightower is CTO of Mammatus which focuses on Cloud Computing, EC2, etc. Rick is invovled in Java CDI and Java EE as well. linkedin,twitter,blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp