• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp custom tags

 
namrata jain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Java class:DemoCustomTag .java



tdl file:DemoCustomTdl.tdl


jsp page:democustomtag.jsp



when i run this program in netbeans it fire the exceptions
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 10; The processing instruction target matching "[xX][mM][lL]" is not allowed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(XMLScanner.java:675)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(XMLDocumentFragmentScannerImpl.java:1024)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(XMLScanner.java:643)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:912)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:846)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:775)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:242)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:345)
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:225)
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:291)
at org.apache.jasper.compiler.TldLocationsCache.getUriFromTld(TldLocationsCache.java:562)
at org.apache.jasper.compiler.TldLocationsCache.processTldsInFileSystem(TldLocationsCache.java:527)
at org.apache.jasper.compiler.TldLocationsCache.processTldsInFileSystem(TldLocationsCache.java:512)
at org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:321)
at org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:272)
at org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:556)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:480)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:562)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1626)
at org.apache.jasper.compiler.Parser.parse(Parser.java:165)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:223)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:124)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:184)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:409)
at org.apache.jasper.JspC.processFile(JspC.java:1150)
at org.apache.jasper.JspC.execute(JspC.java:1319)
at org.netbeans.modules.web.project.ant.JspC.main(JspC.java:97)
at org.netbeans.modules.web.project.ant.JspCSingle.main(JspCSingle.java:125)
org.apache.jasper.JasperException: PWC6180: Unable to initialize TldLocationsCache
D:\My_Workspace\webappdemo\nbproject\build-impl.xml:573: Java returned: 1
BUILD FAILED (total time: 1 second)



even though i can include the jar file of jstl

any help would be highly appriciated....
 
K. Tsang
Bartender
Posts: 3609
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your JSP taglib declaration, the URI should start with a "/"



Everything else seems fine. If your java class is in a package, make sure the tld file <tag-class> is fully qualified name. And may want to add @Override annotation for the doStartTag() method.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K. Tsang wrote:In your JSP taglib declaration, the URI should start with a "/"

Not correct. The URI as defined in the tag lib is:
The tag lib declaration in the JSP must match that; not some file path.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. This has nothing at all to so with the JSTL, so I don;t know why that was even brought up.
 
K. Tsang
Bartender
Posts: 3609
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:The URI as defined in the tag lib is:
The tag lib declaration in the JSP must match that; not some file path.


Oh yes I saw that but forgot to mention it. Thanks for reminding.

 
namrata jain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir as you said i am incliding "/" before WEB-INF then to same exception cause after compilation then what to do
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) The tld file should be named with a .tld extension
2) Make sure your .tld file doesn't have any space or newline or other such characters before the <?xml version="1.0" encoding="ISO-8859-1" ?> content
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!