Im writing a simple Hello tag (custom tag) I wrote my jsp, hello.tld, and the class file. My web.xml looks like this: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
My hello.tld source is this: <?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.0</jspversion> <shorname>examples</shortname> <info>Simple example library.</info> <tag> <name>hello</name> <tagclass>tagext.HelloTag</tagclass> <bodycontent>JSP</bodycontent> <info>Simple example</info> </tag> </taglib> This hello.tld is place under WEB-INF\tlds When ever I start the server it gives me a bunch of errors. Please help
You probably made some typo errors: 1. At your header, '...Sun MicroSystems...' should be '...Sun Microsystems...' (note lower case 's' in 'Microsystems') 2. <shorname> should be <shortname> (note: you didn't type 't') I placed these corrections and tomcat run fine. I assume you're using tomcat 4. I noticed you're using version DTD Web Application 2.3 in your web.xml and DTD JSP Tag Library 1.1 in your hello.tld. You will be encountering less headaches than I had if you start using DTD JSP Tag Library 1.2 in your .tld. Aside from additional features, note the difference in tag naming between versions 1.1 and 1.2 e.g. <tlibversion> and <jspversion> in 1.1 versus <tlib-version> and <jsp-version> for 1.2. The 1.2 naming is more consistent with the tag namings in web.xml (which uses DTD Web App...2.3) and will probably be what would be followed in future versions e.g. 1.3(?). Sample heading for 1.2 version is: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://com.java.sun/dtd/web-jsptaglibrary_1_2.dtd"> note difference in the "http.. " line. In version 1.1 it is "http://java.sun.com..." and there's no '.../j2ee/...' in 1.2. why the makers change their minds on these matters is probably for a good reason.... ... .. . and I hope they also clarify it to us, greens, if we don't find out first .