Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mr. Simon Brown, Could You Help With This Custome Tag Problem?  RSS feed

JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Several people have helped looking into my source codes, and the codes worked fine on their "Tomcat". However, I have had problem to make it work on both WebLogic 5.1.0 and 6.0. This is a very simple JSP Custom Tag, the error message I have been getting on both WebLogic 5.1.0 and WebLogic 6.0 are the same:
Parsing of JSP File '/SimpleExample.jsp' failed: --------------------------------------------------------------- /SimpleExample.jsp(6): Could not parse deployment descriptor: cannot resolve 'csajsp-taglib.tld' into a valid tag library probably occurred due to an error in /SimpleExample.jsp line 6: <%@ taglib uri="csajsp-taglib.tld" prefix="csajsp" %> ---------------------------------------------------------------
There are five, but very small files involved. Please allow me to load my source code:
1. The Web application deployment descriptor, web.xml, under c:\bea\wlserver6.0sp1 \config\mydomain\applications\DefaultWebApp_myserver \WEB-INF
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "">
<taglib-location>/WEB-INF/csajsp-taglib.tld</taglib-location> </taglib>
Note: I have tried both <taglib-location>csajsp-taglib.tld</taglib-location>

2. The tag library descriptor file, csajsp-taglib.tld, which is a .xml file, is under the same directory as where web.xml is c:\bea\wlserver6.0sp1 \config\mydomain\applications\DefaultWebApp_myserver \WEB-INF
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "">
<!-- a tag library descriptor -->
<!-- after this the default space is "" -->
<info> A tag library from Core Servlets and JavaServer Pages,
<name>example</name> <tagclass>coreservlets.tags.ExampleTag</tagclass>
<info>Simplest example: inserts one line of output</info>
<!-- TOMCAT 3.1 DOES NOT SUPPORT BODYCONTENT <bodycontent>empty</bodycontent> -->

3. The JSP page, SimpleExample.jsp is under c:\bea\wlserver6.0sp1 \config\mydomain\applications\DefaultWebApp_myserver
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ taglib uri="csajsp-taglib.tld" prefix="csajsp" %>
<TITLE><csajsp:example /></TITLE>
<LINK REL=STYLESHEET HREF="JSP-Styles.css" TYPE="text/css"> </HEAD>
<H1><csajsp:example /></H1>
<csajsp:example />
4. The style sheet that is used in the JSP page, JSP-Styles.css, is in the same directory as where the JSP page is
<STYLE TYPE="text/css">
BODY { background-color: #FDF5E6 }
A:hover { color: red }
H1 { color: #440000; text-align: center; font-family: Arial Black, Arial, Helvetica, sans-serif }
H2 { color: #440000; text-align: left; font-family: Arial, Helvetica, sans-serif }
H3 { color: #440000; text-align: left; font-family: Arial, Helvetica, sans-serif }
UL { margin-top: 0; border-top-width: 0; padding-top: 0 }
DT { font-weight: bold; }
PRE { font-size: 105%; }
CODE { font-size: 105%; }
.TOC { font-size: 90%; font-weight: bold; font-family: Arial, Helvetica, sans-serif }
TH.COLORED { background-color: #FFAD00 }
TR.COLORED { background-color: #FFAD00 }
TH.TITLE { background-color: #EF8429; font-size: 28px; font-family: Arial, Helvetica, sans-serif; }
5. The tag handler Java class file, ExampleTag.class, is under c:\bea\wlserver6.0sp1 \config\mydomain\applications\DefaultWebApp_myserver \WEB-INF\classes\coreservlets\tags
and the below is the source code for the tag handler Java file,
package coreservlets.tags;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class ExampleTag extends TagSupport {
public int doStartTag() {
try {
JspWriter out = pageContext.getOut();
out.print("Custom tag example "
+ "(coreservlets.tags.ExampleTag)");
catch(IOException ioe) {
System.out.println("Error in ExampleTag: " + ioe);
and I typed http://localhost:7001/SimpleExample.jsp in the browser window.

Thank you.
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have a copy of WebLogic 6.0 (sp1) sitting on my PC so I've looked at your problem by creating the appropriate files from your post. I then compiled the ExampleTag class and started up WebLogic and it worked first time.
Have you tried removing the example files and re-creating them, perhaps on a fresh copy of WebLogic?
Simon Brown
Co-author of Professional JSP 2nd Edition
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!