wood burning stoves 2.0*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Tag library problem ..." Watch "Tag library problem ..." New topic
Author

Tag library problem ...

Raul Martinez
Greenhorn

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..
thanks!
jm

The error:

The files involved in my experiment

SimpleTag.java (tag handler):

simpletag-taglib.tld:


simpletag.jsp:


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

Joined: Nov 07, 2003
Posts: 4982
Hi,
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)
Nick.


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
Greenhorn

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

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
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
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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
Greenhorn

Joined: Mar 01, 2004
Posts: 17
got it!! thanks a lot!!
jm
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.
Nick.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Tag library problem ...