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
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
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
Sun Certified Java Programmer for Java 2.0 (93%) <p>----Winners always make the learning a habit
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" >
...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
Joined: Mar 22, 2002
Posts: 106
posted
0
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
Joined: Mar 22, 2002
Posts: 106
posted
0
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
Ranch Hand
Joined: May 10, 2000
Posts: 1860
posted
0
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
Joined: Mar 22, 2002
Posts: 106
posted
0
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
Ranch Hand
Joined: May 10, 2000
Posts: 1860
posted
0
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
Joined: Mar 22, 2002
Posts: 106
posted
0
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
Ranch Hand
Joined: May 10, 2000
Posts: 1860
posted
0
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
Joined: Mar 22, 2002
Posts: 106
posted
0
it is there Simon
Simon Brown
sharp shooter, and author
Ranch Hand
Joined: May 10, 2000
Posts: 1860
posted
0
taash mg
Ranch Hand
Joined: Mar 22, 2002
Posts: 106
posted
0
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
Joined: Mar 22, 2002
Posts: 106
posted
0
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
Joined: Mar 22, 2002
Posts: 106
posted
0
Hi But then if i quit i wouldn't learn so somebody please help me out here
thanks
sim sim
Ranch Hand
Joined: Jun 05, 2002
Posts: 55
posted
0
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
Hi Taash, Please compile JavaScriptEx.java first and include that into ur classpath as well. Then compile JavaScriptExTag.java
taash mg
Ranch Hand
Joined: Mar 22, 2002
Posts: 106
posted
0
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
Joined: Mar 22, 2002
Posts: 106
posted
0
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
Joined: Mar 22, 2002
Posts: 106
posted
0
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