Unable to create a custom tag
Hi All
i am trying to make a custom tag in jsp2.0. I have made the java class which override the doTag method. I have created the tld file and put it in the directly WEB-INF FOLDER.I have written a jsp as well which uses this tag and the uri in the jsp mathces the uri in the tld file. Then it gives me the error message that unable to find the tld file.
then i made entry in the web.xml as well but now it is giving me an error:
JSPG0227E: Exception caught while translating /UseCustom.jsp: /UseCustom.jsp(19,1) --> JSPG0009E: Unable to load tag handler class com.hcl.taghandlers
I am using jstl 1.1 and jsp2.0 and the IBM Rational editor.
please help as soon as possible.
thanks in advance!!!!!!!!
There was a very minute syntax mistake in the web.xml.
now it is working fine.
By the thanks to all those who devoted some time to think over it.
Similar Messages
-
Problem in creating a custom tag
Hi All,
I'm new to jstl. I want to create a custom tag. I created a sample java class and sample tld file and I used this file at my page it give me an error. The java and tag file code is as follow
package mytag;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
* This is a simple tag example to show how content is added to the
* output stream when a tag is encountered in a JSP page.
public class Hello extends TagSupport {
private String name=null;
* Getter/Setter for the attribute name as defined in the tld file
* for this tag
public void setName(String value){
name = value;
public String getName(){
return(name);
* doStartTag is called by the JSP container when the tag is encountered
public int doStartTag() {
try {
JspWriter out = pageContext.getOut();
out.println("<table border=\"1\">");
if (name != null)
out.println("<tr><td> Hello " + name + " </td></tr>");
else
out.println("<tr><td> Hello World </td></tr>");
} catch (Exception ex) {
throw new Error("All is not well in the world.");
// Must return SKIP_BODY because we are not supporting a body for this
// tag.
return SKIP_BODY;
* doEndTag is called by the JSP container when the tag is closed
public int doEndTag(){
return EVAL_PAGE;
<?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>sample</shortname>
<info>My sample tag</info>
<tag>
<name>hello</name>
<tagclass>tag.Hello</tagclass>
<bodycontent>empty</bodycontent>
<info>
This is a simple hello tag.
</info>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>And I use this tld file in my jsp code I got below error
* org.apache.jasper.JasperException: /mytag.jsp(9,15) Unable to load tag handler class "tag.Hello" for tag "sample:hello"
Help me about this problem.
Edited by: Get2win4world on Dec 15, 2009 1:12 AMYour class (according to what is posted) is in the package mytag.
So in your tld: <tagclass>tag.Hello</tagclass>should be<tagclass>mytag.Hello</tagclass>cheers,
evnafets -
How to create a custom tag for a custom converter
In Jdeveloper 11g, I have a project where I have created a custom converter class that impements the javax.faces.convert.Converter class. I have registered the converter with an id in the faces-config.xml file of the project, and the converter works fine by using the <f:converter type="myconverter"> tag. However, the custom converter has a field which I would like to set from the tag itself. Hence, I would like to add an attribute to <f:converter> tag if possible or create a custom tag that has the attribute.
I have done some reserach and I found that a custom tag can be implemented: I need to create a class which extends from the ConverterTag class or javax.faces.webapp.ConverterElTag class, which I did, but I also need to create ".tld" (tag library) file which defines the tag itself.
The part about creating the ".tld" file and registring the new tag is what I'm not sure how to do.
Does someone know how to do this?
thank youHi frank,
that's a good document, and it explains how to make a custom converter. I already created the custom converter, it converts a number to any currency pattern. I know java already has a currency converter, but it doesn't support Rupee currency format, and I need that format.
My converter works, but I would like to pass the pattern of the format through an attribute in a tag. Since f:converter doesn't seem to support that, I created a custom tag which uses my converter, and it enables me to pass a pattern to the converter.
All of that works, but I need to be able to pass the pattern as an EL expression, and it's not evaluating the expression before passing it to the converter. It just passes the whole expression as a string. I'm thinking It may be something I'm doing wrong.
this is the tag library definition file:
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.2</tlib-version>
<jsp-version>2.1</jsp-version>
<short-name>custom</short-name>
<uri>custom-currency-converter</uri>
<description>
custom currency custom tag library
</description>
<tag>
<name>CurrencyConverter</name>
<tag-class>
converter.Tag.CurrencyConverterTag
</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>pattern</name>
<type>java.util.String</type>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
Edited by: Abraham Ciokler on Feb 4, 2011 11:20 AM -
How To create a custom tag in jsf
I'm trying to create a custom tag in jsf.what should be the approach to create it.it would be better if somebody will explain me from the skretch.
There's a decent tutorial here, Priyo:
http://www.exadel.com/tutorial/jsf/HowToWriteYourOwnJSFComponents.pdf
Hope it helps,
Illu -
Unable to Create a Customer in Accounts Receivable
Hi,
I am unable to create a customer in Accounts Receivable module (in Ver 12.0.04). I am getting the following error message.
FND_SESSION_MANAGEMENT.UPDATESESSIONCONTEXT SQLException: java.sql.SQLException: OALL8 is in an inconsistent state
Could some one help me on resloving the issue.
Thanks
Vijendrahi
USE tcode <b>VD01</b> in order to create a customer for SD which will have sales area data.
for centrally itis XD01
regards -
Unable to create a customizing request to transport BPC10 content to Quality
Hi
Unable to create a customizing request to transport BPC10 content to Quality .
From the transport connections tab, i am selecting the required objects and then clicking the transport truck but it does not pop up and ask for a transport request .
So please provide any solution.Hi,
Check whether Standard transport switched-on is enabled or not. To get transport request your setting should be as follows : RSA1-->Transport Connection-->Edit-->Transport
Hope it helps...
regards,
Raju -
I want to create a custom tag that has a attribute that ask
for a number. like below...
<cf_makeattributes number="?">
Now say I made that number something like 5
<cf_makeattributesnumber=
"5">
I would like for the tag to take that number and make 5
attributes called "Form" in a array from 1 to 5 like below...
<cfset attributes.form = arraynew(1)>
<cfloop index="i" from="1" to="#attributes.number#">
#attributes.form
</cfloop>
Is it possible to make a tag that ask for a number like 5 and
make 5 attributes and within the same tag assign values to those 5
attributes. for example consider the above.
<cf_makeattributes number="5" attribute1="hi"
attribute2="hello" attribute3="howdy" attribute4="hey"
attribute5="HOWE!">
or say i want to make 2 attributes and assign 2 values to
those attributes
<cf_makeattributes number="2" attribute1="This tag asked
for 2 numbers" attribute2="and therefore gave me the ability to
make 2 attributes">
I also have another question that kinda applies to the
question above.
How does the coldfusion server read the tags. for example
look at below
<cf_makeattributes number="2" attribute1="hello"
attribute2="world">
would the server read it like this...
step 1
<
cf_makeattributes number="2" attribute1="hello"
attribute2="world">
step 2
<cf_makeattributes
number="2" attribute1="hello" attribute2="world">
step 3
makeattributes.CFM (it now goes to the template that holds
the tags scripts)
Or does it first read all thats bold below
<cf_makeattributes
number="2" attribute1="hello" attribute2="world">
then goes to the makeattributes template. Is there away I
can compile my script one step at a time like C# and C++ just to
see the steps
PLUS Do i have to put my custom tag into a specific folder or
can I just put it in the same folder as the document thats calling
the custom tag> I could either make a bunch of attributes that will grab
all the
> values or I could loop out a array of attributes. Thats
my goal
I was with you until that line. The term attributes is
confusing in this context. I'm not sure if you're talking about
attributes in a generic sense or the custom tag attribute
scope.
> Now here wat im thinking now. What if instead I put the
forms in a list. something like this...
> <cf_Formentry
Forms="#Form.one#,#form.two#,#form.three#">
Do you mean form
fields?
Let's try this from a different angle. Can you give a
concrete example of the desired results using this form?
<form>
<input name="username1" value="Alice">
<input name="username2" value="Bob">
<input name="username3" value="Kyle">
<input name="username4" value="Michelle">
<input name="username5" value="Robert">
</form> -
Unable to Create a custom folder in Discoverer Administrator
Hi,
I have a discoverer report which is based on on standard query(Which cant be modified).The requirement is to add a new column to it which doesn't exist in that folder.I can create a custom folder and add the column to the report,but the problem is whenever i create the folder and hit the Validate SQL button it is throwing the error " *The custom SQL entered is not valid SQL statement - ORA-00942: table or view does not exist* "
I have all the privileges for the user and when I am trying to validate the existing queries ,it is throwing the same error .
Discoverer Version - 4 i
Oracle Application - 11.5.9
Appreciate your help .
Thanks ,
VijayHi,
Creating new folders should be done when you are logged on as an application user.
If your application user does not have admin access to the EUL then log on the Disco Admin as the EUL owner and grant full admin privileges to an applications user or responsibility.
Then logon to Disco Admin with that user or responsibility. You should then be able to create and import folders.
Rod West -
Creating first custom tag, problems importing in WebSphere studio...
I'm trying to write a tag handler for my .tld file, but WebSphere won't recognize the following import statements:
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
TLD file:
<?xml version = "1.0" encoding = "ISO-8859-1"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/Web-jsptaglibrary_1_2.dtd">
<taglib xmlns = "http://java.sun.com/JSP/TagLibraryDescriptor">
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>Custom Tags Library</short-name>
<description>
Custom tags test.
</description>
<tag>
<name>customTags</name>
<tag-class>source.com.tags</tag-class>
<description>
formatted text box:
</description>
<attribute>
<name>mandatory</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>optional</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
- ls6vYou have to find the JAR(s) that contain the J2EE API (found in your Server download) and include them in the WebSphere classpath.
-
How to create the customizing TAG coloum in So10 transaction
Hi All,
I need to create the Tag Coloum in in SO10 ( standard text) transaction .
Basically i want to create the customised tag format and attach it to the format where we will see all the standard tag in so10.
I need to create the TAG in which first line should be start from 0.00 and from the second line onwards it should be start from the 2.3 .
Dhiraj.Dhiraj,
What you will have to do is to create a separate STYLE in sMART FORMS transaction and assign that STYLE to the TEXT in S010. You can do that Format --> Change STYLE.
The tag column contains format keys which define the output formatting of the text or initiate control commands. The format keys possible and their respective meanings are defined in styles or forms. If a style or form is assigned to a text module you can use the paragraph formats defined there to format your text. Format keys which can be defined by the user can consist of one or two characters.
I have not tried this though.
regards,
Ravi
Note : Please mark the helpful answers -
Help creating a custom tag from a scriplet
I am trying to make a cusom tag to replace this peice of code:
<TABLE >
<%
out.println("<TABLE >\n" +
"<TR BGCOLOR=\"#FFDDAA\">\n" +
" <TH>ID Number\n" +
" <TH>Artist\n"
Iterator it = pricePassed.getpricePassed().iterator();
while( it.hasNext() ){
MySite.VideoBean vids = (MySite.VideoBean) it.next();
out.println( "<TR>\n" +
"<TD><Center><B>" + vids.getRecId() + "</TD>" +
"<TD><Center><B>" + vids.getArtist() + "</TD>"
</TD></TR>\n" );
%></TABLE>The following is no where near perfect i just want to post it so i can get opinions to see if i am going about it the right way:
import java.io.*;
import java.util.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class TableTag extends BodyTagSupport {
private List passedIn;
public void setItems(List workon) {
passedIn = workon;
public int doAfterBody() throws JspException {
BodyContent body = getBodyContent();
String body1 = body.getString();
body.clearBody();
List list = body1.length() >0 ? text2List(body1) : passedIn;
if (list == null) return SKIP_BODY;
try {
JspWriter out = body.getEnclosingWriter();
out.println("<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +
"<TR BGCOLOR=\"#AADDFF\">\n" +
" <TH>Artist\n" +
Iterator it = passedIn.setItems().iterator();
while( it.hasNext() ){
MySite.videoBean vids = (MySite.videoBean) it.next();
out.println( "<TR BGCOLOR=\"#FFAD00\">\n" +
"<TD><Center><B>" + vids.getArtist() + "</TD>"
</TD></TR>\n" );
} catch (IOException ex) {
throw new JspTagException(ex.getMessage());
} // try
return SKIP_BODY;
}If you go to the page where it lists all the forums and scroll way, way, down you will find there's a JSP forum. That is really where you should post this kind of question.
-
How to create a new custom tag in JSF 1.2
Hi there,
In JSF 1.2, all the classes (CommandButtonTag, CommandLinkTag, DataTableTag,...) in package com.sun.faces.taglib.html_basic are defined as final class. In JSF 1.1, we can create a custom tag that extends the tag in JSF taglib; it save us lots of time.
Could anybody know how to create a new custom tag in JSF 1.2?
Many thanks,
EmilyIf I recall, it was done because how tags were to be handled in 1.2 was very different from 1.1 and it was felt that developers shouldn't rely on implementation specific classes (unless they were SPI) for several other reasons (application portability being the big one here).
If it's felt that this was the wrong decision, please feel free to log an issue [1] against the RI (to date, no one has).
As to the 'borked' dependency URLs, please log an issue [1] if you find these. We have nightly builds going that work from a clean workspace and checking today's result, it seems ok.
[1] https://javaserverfaces.dev.java.net/issues -
Unable to create custom analytic in dashboard and analytics in infoview
Hi all,
i am unable to create a custom analytic in dashboard and analytics in infoview, the error i am getting is there is no xcelsius template available consult xcelsius .
Need help ?
regards
Abid PaulHello Falk,
thanks for the reply
this is not the error i am getting in Xcelsius.but this is the error which i am getting in INFOVIEW BO edge standard 3.1 when i am trying to create custom analytic in corporate dashboard FROM INFOVIEW.
THE error i am getting is there are no xcelsius templates availabe consult xcelsius.
i would really appreciate if you could help me regarding this
Regards and thanks
ABID PAUL -
Hi folks,
I am trying to create a custom tag that accepts a java.util.Locale as a parameter, and for some reason the container is giving me all kinds of attitude. Here's the detail:
----from the .tld---
<tag>
<name>loadMasthead</name>
<tag-class>uiTagHandlers.LoadMasthead</tag-class>
<body-content>empty</body-content>
<description>Paints the masthead for a given page</description>
<attribute>
<name>locale</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.util.Locale</type>
</attribute>
</tag> ---end tld--
from the jsp-
<%@ taglib uri="/WEB-INF/simpleUITags.tld" prefix="helper" %>
<%@ page import="java.util.Locale" %>
<helper:loadMasthead locale="<%= Locale.US %>" />---end jsp----
---from the handler-----
public int doTagStart() throws JspTagException{
JspWriter out = pageContext.getOut();
try{
if( locale != null)
out.print( UIHelper.loadMasthead(locale) );
else
out.print( UIHelper.loadMasthead() );
}catch( Exception ex ){
throw new JspTagException( ex.getMessage() );
return SKIP_BODY;
public int doTagEnd() throws JspTagException{
return SKIP_PAGE;
* Sets the locale.
* @param locale The locale to set
public void setLocale(java.util.Locale locale) {
this.locale = locale;
end handler---
Here's the error I'm getting from the container:
[8/5/04 12:14:34:704 EDT] 7abbd628 WebGroup E SRVE0026E: [Servlet Error]-[Unable to convert string '<%= Locale.US %>' to class java.util.Locale for attribute locale: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager]: org.apache.jasper.JasperException: Unable to convert string '<%= Locale.US %>' to class java.util.Locale for attribute locale: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:920)
at org.apache.jsp._index._jspService(_index.java:84)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
Any ideas what is going on here?
Thanks in advance,
MattThe taglib always passes a string. The container is supposed to change it to the proper object, but some do not, as it wasn't clear in the original specs (I found various bug reports). My container does not do this properly for taglibs, so I ended up using a bean, which it processed correctly.
Your container can't figure out how to change the String it receives to the Locale object it's supposed to set the property to.
I found a similar problem displayed here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4727371
You'd need to check with your container docs to see if yours is supposed to be able to do the conversion. If not, you'll either need to write it yourself or do what I did and use a bean so it never passes a string to begin with. -
Custom tag with rendered attribute
Is it possible to create a custom tag that operates similar to a JSF tag with the rendered attribute? Wrapping output with c:if test="..." is not as nice as the JSF rendered option, but I don't want to use JSF for this particular project.
Edited by: black_lotus on Nov 23, 2007 12:13 PMTLD File, per your previous recommendation:
<attribute>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>My Tag class (snippet):
public class ButtonTag extends TagSupport
private boolean disabled;
public ButtonTag() {}
public boolean isDisabled()
return disabled;
public void setDisabled(boolean b)
disabled = b;
}A sample of the jsp file invoking it:
<c:set var="result" value="${computedValue}"/>
<ltm:button disabled="${result}"/>Regardless of the value of result, ("true" or "false") it always passes false to the setDisabled method of the button tag class.
Maybe you are looking for
-
When I click on a PDF file I can't open it.
When I attempt to open a PDF file I receive a message "Adobe Acrobat/Reader can not be used to view PDF files in a web browser." I have Adobe Reader 9+ installed that presumably opens PDF files. Is there a way to work around this problem or must I pu
-
Photos not appearing in iPhoto when importing from SD card
On the first instance of using my camera to import photos to iphoto, I used the SD card reader integral on the new iMACs; this worked fine - all photos appeared, I selected import and there they were. Since then, when I insert the SD card, it appears
-
Get modified date inside the File content of CM
hi, In CM I have uploaded a file and have set the permission to modify the file to a group of users.Now when each and every time any user modifies the file content I want to have the modified date inside the updated file. How can i achieve this?.....
-
Satellite L300D-11V - DVD drive disappeared
I have an L300D 11V. The DVD drive seems to have disappeared can someone suggest a way of getting replacement drive? They don't appear to be in the computer. thanks
-
I want to buy the Production Premium CS3 educational lincense but I read that it only activates once per 12 months which doesn't work for me because I reinstall windows frequently to get rid of viruses and other problems. I've been screwed before wit