• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tag library problem ...

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
got it!! thanks a lot!!
jm
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic