• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

custom tag not working

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i am just trying a simple example of a custom tag. but it does not run and gives root cause as INVALID PUBLIC ID- ....
can anybody help me to learn this properly
heres my web.xml and the error---
web.xml


B]Tomcat's response[/B]


Thanks
Taash
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i got that error,my tld file had a different public definition, so i have corrected that but i still can't work this out as now Tomcat has proceded to say that

tlibversion needs to be decleared


heres the error

and my tld file

someody please enlighten me about this

thanks
taash
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
can u post me the jsp code ? I want to see how u r referring the taglib...
Since your taglib-uri is /WEB-INF/classes/js ,
you should have
<%@ taglib uri="/WEB-INF/classes/js" prefix="something" %>
and yr JavaScriptExTag.tld should be under /WEB-INF/

Hope this helps ..
A.Umar
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI taash,
Try this in your tld.
<?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" >

Hope this works.
Regards,
Sim Sim.
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...and if you're using Tomcat 4, you can use the newer JSP 1.2 DTD (although some of the element names have changed) :

Simon
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
Thanks to Simon and sim sim the xml problem is solved now though it has a path problem
Umar my jsp file has the same code but have a look
i m posting my JavaScript_Tag.jsp file
please help me correct the issues here
JavaScript_Tag.jsp

Thanks
Taash
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
just in case
this is the hierarchy for my files
/WEB-INF/web.xml
/WEB-INF/JavaScriptExTag.tld
/WEB-INF/classes/JavaScriptExTag.java
/WEB-INF/classes/JavaScriptEx.java
/jsp/JavaScript_Tag.jsp

and a part of the root cause for error


Thanks
Taash
 
Simon Brown
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll need to put your tag handler class in a package, and then modify the TLD file appropriately. For example:
<tag-class>myPackage.JavaScriptExTag</tag-class>
(notice also that there is no leading / character)
Cheers
Simon
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Simon,
i tried changing the hierarchy
so now it looks like this
this is the hierarchy for my files
/WEB-INF/web.xml
/WEB-INF/JavaScriptExTag.tld
/WEB-INF/classes/sunskriti/JavaScriptExTag.java
/WEB-INF/classes/sunskriti/JavaScriptEx.java
/jsp/JavaScript_Tag.jsp
and in my tld file
i modified it by putting it into a package called sunskriti

i also modified both my java files and added package statements but still am not getting result


 
Simon Brown
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you placed the compiled classes under /WEB-INF/classes too? That is :
/WEB-INF/classes/sunskriti/JavaScriptExTag.class
/WEB-INF/classes/sunskriti/JavaScriptEx.class
Simon
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Simon
thanks for reminding me i nearly forgot that i had to compile these classes, silly of me any ways i did that but the class JavaScriptExTag really doesn't compile. it gives me many error
this is the code

it actaully doesn't recognise the Jsp Exceptions. wonder why?? i think we have imported the proper classes
is this Exception custom made in the wrox package?
Thanks again for all the help
 
Simon Brown
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using Tomcat 4, you need to put the servlet.jar file (from TOMCAT_HOME/common/lib) in your CLASSPATH.
HTH
Simon
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is there Simon
 
Simon Brown
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey
what do i do now, actaully trying examples takes a lot of time and i have my exams soon


maybe i should try them after my exams???
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey
what do i do now, actaully trying examples takes a lot of time and i have my exams soon


maybe i should try them after my exams???
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
But then if i quit i wouldn't learn so somebody please help me out here

thanks
 
sim sim
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Taash,
I suggest you check your classpath once again, I have tried to compile your code and I got only one exception, cannot find,
JavaScriptEx JS = new JavaScriptEx();
I have commented the following lines
//JavaScriptEx JS = new JavaScriptEx();
//ls_alert=JS.alert(ls_message.trim());
and it compiled in a jiffy.
Pl check ur classpath for
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
Regards,
Sim Sim
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Taash,
Please compile JavaScriptEx.java first and include that into ur classpath as well. Then compile JavaScriptExTag.java
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
sim sim
I already have tools.jar in my classpath? Do i need to put jasper.jar too? as i have about 11 errors when i try to compile JavaScriptExTag.java and mostly regarding JspException and the other stuff.
this is a part of it

amit
i have already complied JavaScriptEx.java before doing this and both of these files are in the same directory.. but i am still not getting through this code
thanks
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi sim sim
i have my classpath set to this
where C:\jakarta-tomcat-4.0\webapps\ROOT\WEB-INF\classes\sunskriti

please let me know if i can do anything to aorrect it and incorporate things as u mentioned earlier. with this path it gives me the 11 errors
thanks
 
taash mg
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi sim sim
why actually am i getting 11 - 12 errors while u r getting less which means i m missing something. Something is not properly configured. please help
thanks
reply
    Bookmark Topic Watch Topic
  • New Topic