wood burning stoves*
The moose likes JSP and the fly likes Tag library problem ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Tag library problem ..." Watch "Tag library problem ..." New topic

Tag library problem ...

Raul Martinez

Joined: Mar 01, 2004
Posts: 17
Development Environment:
Java Runtime: version "1.4.2"
Tomcat: version 5.0.19
I'm following the Free PDF book entitled 'Core Servlets and JavaServer Pages' 1st ed. by Marty Hall. The topic is all about Tag Library.. he pointed out that the example is based on Tomcat 3.1 beta (which I suspect is the cause of my problem). Anyway, I got an error which prevented me from continuing my experiment... The tld file is based on the example on the book..

The error:

The files involved in my experiment

SimpleTag.java (tag handler):



Learning new things, I LIKE!<p>---certification---<br />none so far, experience (considerable, yeah)
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
According to the DTD:

There is NO attribute urn inside taglib.
Could you try removing the urn tag and see whether it works? (As you have not provided any value to it in fact)

SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Raul Martinez

Joined: Mar 01, 2004
Posts: 17
After removing the <urn></urn> the error becomes...

type Exception report
description The server encountered an internal error () that prevented it from fulfilling this request.
org.apache.jasper.JasperException: XML parsing error on file /jspTest/tags/./simpletag-taglib.tld: (line 26, col 10): The content of element type "tag" must match "(name,tagclass,teiclass?,bodycontent?,info?,attribute*)".
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:189)
at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:243)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:183)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
The content of element type "tag" must match "(name,tagclass,teiclass?,bodycontent?,info?,attribute*)".

You've got <bodycontent> and <info> in the wrong order.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Raul Martinez

Joined: Mar 01, 2004
Posts: 17
got it!! thanks a lot!!
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Hi Raul,
Keep in mind, XML is a semi-structure document. The order of the attributes or sub-element does matter.
You can also check (or validate) your document by some tools, like XML Spy, to see whether your XML document is correct.
It is sorta covered in the JavaRanch Style Guide.
subject: Tag library problem ...
Similar Threads
Unable to open tld : Error
error in opening tld
Problem with custom tags
Custom Tag Compilation
Not the expected output: EVAL_BODY_TAG