It's not a secret anymore!*
The moose likes JSP and the fly likes jsp tag libraries problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp tag libraries problem " Watch "jsp tag libraries problem " New topic
Author

jsp tag libraries problem

maheedar sand
Greenhorn

Joined: Feb 26, 2008
Posts: 23
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

It may not be what's causing this specific problem, but you shouldn't have a blank URI.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
Also you haven't closed the <tlib-version> tag correctly (copy/paste into Eclipse highlighted the error immediately)
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

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.


No pain, No gain.
OCJP 1.6
maheedar sand
Greenhorn

Joined: Feb 26, 2008
Posts: 23
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Still no URI?
maheedar sand
Greenhorn

Joined: Feb 26, 2008
Posts: 23
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
Greenhorn

Joined: Feb 26, 2008
Posts: 23
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

Joined: Jul 06, 2005
Posts: 1016
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.



 
 
subject: jsp tag libraries problem
 
Similar Threads
Class not found..
facelets and custom tags
custom tags & tag handlers REVISITED
external entity problem
external entity not found jsp