This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes CustomTag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "CustomTag" Watch "CustomTag" New topic
Author

CustomTag

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
Hello Ranchers,
Do i need to include any special JAR file for testing Custom Tag handler.I tried to use SimpleTagSupport class, but I cannot find that in the library.

thanks
Shashank


SCJP 1.4, SCWCD 1.4, SCBCD 1.5
Sathish Nagappan
Ranch Hand

Joined: Nov 05, 2005
Posts: 76
No ,
If you are using JSTL , yes you need to add a few classes to your source path.
But for custom tags, you dont need to install anything extra other than the jdk and the web container/J2ee container.
So if a normal servlet program , JSP program runs, then there is some other problem with your code.


SCJP, SCWCD, SCBCD, IBM XML, IBM OOAD, SCEA 5, ITAC - Distinguished IT Architect.
Gaurav Gambhir
Ranch Hand

Joined: Mar 04, 2006
Posts: 254
No, only things you need are JSP page, tld file and Tag handler
Try this

customTag.jsp

<%@ taglib prefix="myTags" uri="simpleTag"%>
<html><body>
<myTags:simple1/>
</body></html>


SimpleTag.tld

<?xml version="1.0" encoding="ISO-8859-1" ?>

<taglib 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"
version="2.0">

<tlib-version>0.9</tlib-version>

<short-name>simpleTags</short-name>
<uri>simpleTag</uri>
<tag>
<description>Use of custom tags</description>
<name>simple1</name>
<tag-class>com.example.web.SimpleTagTest1</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>


com/example/web/SimpleTagTest1.java
package com.example.web;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import javax.servlet.jsp.JspException;
public class SimpleTagTest1 extends SimpleTagSupport{
public void doTag() throws JspException,IOException{
getJspContext().getOut().print("This is the use of custom tag");
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CustomTag
 
Similar Threads
Cant use object from another class
WA #1.....word association
Posting to bump up my count...
Text box value is not being completely filled with request attribute
The x900 effect ?