Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tag library problem ...

 
Raul Martinez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Raul Martinez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The content of element type "tag" must match "(name,tagclass,teiclass?,bodycontent?,info?,attribute*)".

You've got <bodycontent> and <info> in the wrong order.
 
Raul Martinez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it!! thanks a lot!!
jm
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic