Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 350
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Yes, my master! Here is the tiny ad you asked for:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic