Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

cannot find the declaration of element 'taglib'

843840Apr 17 2008 — edited Apr 18 2008
Hi All,

I have started recently learning custom tag development and i am using eclipse

here are my eclipse configuration details:
Version: *3.0.2*
Build id: 200503110845

and i think i dont have myeclipse plugin(because i dont see any provider as myeclipse in plugin details)

and i have configured my eclipsee to use Tomcat 5.x version

In eclipse i have created a project as Tomcat project

and these are the files i have created:
actually when i created a new tomcat project it generated two WEB-INF folders in the project one is WEB-INF/src and another one is just WEB-INF

in WEB-INF/src there is a packeage named foo and in that there is a class SimpleTagTest1.java

here is the code:
package foo;

import java.io.IOException;


import javax.servlet.jsp.tagext.SimpleTagSupport;
import javax.servlet.jsp.JspException;

public class SimpleTagTest1 extends SimpleTagSupport {

	public void doTag() throws JspException, IOException {
		getJspContext().getOut().print("This is the lamest use of a custom tag");
	}
}
I did not get any error for this SimpleTagTest1.java

and i created simple.tld file in the WEB-INF folder
and here are the contents:
<?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>1.2</tlib-version>
<uri>simpleTags</uri>
<tag>
<description>marginally better use of a custom tag</description>
<name>simple1</name>
<tag-class>foo.SimpleTagTest1</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>
for this i am getting an error as cvc-elt.1: Cannot find the declaration of element 'taglib'. simple.tld CustomTag/WEB-INF line 4 April 17, 2008 12:50:50 PM


and i created useTag.jsp in the base project folder
and here are the contents:
<%@ taglib prefix="myTags" uri="simpleTags" %>
<html>
<body>
<myTags:simple1/>
</body>
</html>
for this i am getting an error JSP Parsing Error:File "/simpleTags" not found useTag.jsp Customtag1 line 1 April 17, 2008 7:15:47 PM


I did not create any web.xml

Actually i am studying HFSJ by Kathy& Bert in that book this example is explained..

I am new to eclipse Can any body please also suggest me how do i check that my eclipse is configured to J2EE 1.4 or J2EE 1.5

Please help me..

Thanks & Regards,
Sudhakar Karnati
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 16 2008
Added on Apr 17 2008
3 comments
1,167 views