• 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

jsp tag libraries problem

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am practising tag libraries. This is a small web applictation which connects to database and inserts or updates the database. Everything is find but the problem is with the custom tag library file.


this is a custom tag library tld file.

customLib.tld
============

<? xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">

<taglib>

<tlib-version>2.0<tlib-version>
<jsp-version>1.2</jsp-version>
<short-name></short-name>
<uri></uri>
<description>Tag Libraries Examples</description>

<tag>
<name>ifValidEmailAddr</name>
<tag-class>org.library.tags.implementation.EmailAddressValid</tag-class>
<body-content>JSP</body-content>
<description>allows to connect to database</description>

<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>var</name>
<required>false</required>
</attribute>

<attribute>
<name>scope</name>
<required>false</required>
</attribute>
</tag>
</taglib>

the compiler is reporting the <taglib> must terminate with the end tag </taglib> but the end tag is there. I'm not understanding what compiler is telling. Please help me...

Thanks & Regards,
sathish.g.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It may not be what's causing this specific problem, but you shouldn't have a blank URI.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also you haven't closed the <tlib-version> tag correctly (copy/paste into Eclipse highlighted the error immediately)
 
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like eclipse you have other options tools also (use when you don't have eclipse) Notepad++, any web browser to indicate the error of mixed/missed hierarchy and other etc.
 
maheedar sand
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Even after closing the compiler is reporting the should be terminated by element.

This is the statcktrace:


SEVERE: Parse Fatal Error at line 16 column 3: The element type "taglib" must be terminated by the matching end-tag "</taglib>".
org.xml.sax.SAXParseException: The element type "taglib" must be terminated by the matching end-tag "</taglib>".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1739)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2923)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1543)
at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1685)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1201)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:874)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:317)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4974)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1044)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:967)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1302)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:343)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:323)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1043)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:304)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)



shall I have to write tag file for the <name> tag present in .tld file.

If any errors are there in .tld file please suggest....

customLib.tld



Thanks & Regards,
sathish.g.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still no URI?
 
maheedar sand
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for Bear Bibeault , Stefan Evans for correcting mistakes. I am able to connect to database. JSP URI should be similar to the one that is in .tld file. Otherwise errors.
I also learned how to present code to other developers in a readable manner.
Thanks to coderanch. A beautiful platform where I'm finding some good solutions to my small problems.


Thanks and Regards,
sathish.g.
 
maheedar sand
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The application is working with the IDE. But when I start deploying the application manually in tomcat webapps it is showing up error at the <body-content> tag. I modified the .tld/b> which contains the URI. I'm listing here complete application source code. Please, suggest...

Source code:

customLib.tld

web.xml


The class EmailAddressValid is created under src folder; compiled and placed under WEB-INF/classes folder.

Error
The compiler is telling the taglib should be terminated by the end tag </taglib> but it is already present. Please help...

Thanks and Regards,
sathish.g.
 
Stefan Evans
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It all looks fine to me.

What server are you using to run this?

My suggestions:
Remove the tag library declaration from your web.xml file. It is not necessary.
Start again from scratch with a minimal tld file, and get that working.



 
reply
    Bookmark Topic Watch Topic
  • New Topic