Results 1 to 4 of 4
Thread: JDBC and Custom Tag
- 11-29-2010, 06:11 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 26
- Rep Power
- 0
JDBC and Custom Tag
Hi,
I'm creating a tag library descriptor for the custom tag and test the custom tag in JSP page.
My question is: I have three files, .java, .tld, and .jsp.... I'm not sure where to place them and how to deploy my program???
I opened a terminal and setup tomcat and created a table with information but I'm not sure how to show the information on the .jsp file. I've done the coding but if someone tell me how to execute it?
Please advice.....
- 11-29-2010, 07:40 AM #2
Member
- Join Date
- Oct 2010
- Posts
- 26
- Rep Power
- 0
I Found out how to deploy, but having another problem :(
Hi,
I'm trying to execute my program and having this error,
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/Tags.tld: (line 3, col 6)
org.apache.jasper.compiler.TldLocationsCache.init( TldLocationsCache.java:248)
org.apache.jasper.compiler.TldLocationsCache.getLo cation(TldLocationsCache.java:219)
org.apache.jasper.JspCompilationContext.getTldLoca tion(JspCompilationContext.java:530)
org.apache.jasper.compiler.Parser.parseTaglibDirec tive(Parser.java:419)
org.apache.jasper.compiler.Parser.parseDirective(P arser.java:476)
org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1426)
org.apache.jasper.compiler.Parser.parse(Parser.jav a:133)
org.apache.jasper.compiler.ParserController.doPars e(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:167)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:306)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:286)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:273)
org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
IAccording to the error I have a problem in Tags.tld file... Here is the content:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>Tags</shortname>
<info> Tags Library</info>
<tag>
<name>displayResultSetdata</name>
<tag-class>taglibrary.GetDataTag</tag-class>
<teiclass>taglibrary.DataAccess</teiclass>
<bodycontent>JSP</bodycontent>
<info>Get Data From the Books Database Database.</info>
</tag>
</taglib>
Is there anything wrong in my file??? if yes..how should I fix it??
Thank you
- 11-29-2010, 10:46 AM #3
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
try
<tagclass>taglibrary.GetDataTag</tagclass>
instead of
<tag-class>taglibrary.GetDataTag</tag-class>
TIP:
while creating tags for this file, your IDE (e.g. Eclipse) can help you - just use mouse over some element (like <tag>) and yellow pop-up will show up with useful info like :
So this explains what elements you must have, and when you place them in you file, use mouse over again to show you what is expected within element like ...[0.9] number ...<Tag >
Content Model : (name, tagclass, teiclass?, bodycontent?,
info?, attribute*)
regards!
- 11-29-2010, 10:50 AM #4
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
Or you can download file:
http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd
put it in your project,
and create your tag files from it using wizards in your IDE.
(create XML file form DTD file)
this way you may have more clear picture of what is it that you must conform to while creating your tld
Similar Threads
-
Custom GUI...Help?!
By wadhah.alhaddad in forum New To JavaReplies: 1Last Post: 02-07-2010, 03:54 PM -
How to use JDBC Template classes to control basic JDBC processing and error handling
By Java Tip in forum Java TipReplies: 0Last Post: 04-01-2008, 10:17 AM -
Custom tgs in JSP
By ravian in forum New To JavaReplies: 2Last Post: 12-29-2007, 05:05 PM -
How to use JDBC Template classes to control basic JDBC processing and error handling
By JavaBean in forum Java TipReplies: 0Last Post: 09-28-2007, 12:56 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks