• 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

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

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: java.io.IOException: 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" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<taglib>
<taglib-uri>csajsp-taglib.tld</taglib-uri>
<taglib-location>/WEB-INF/csajsp-taglib.tld</taglib-location> </taglib>
</web-app>
Note: I have tried both <taglib-location>csajsp-taglib.tld</taglib-location>
and
<taglib-location>/WEB-INF/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" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<!-- a tag library descriptor -->
<taglib>
<!-- after this the default space is "http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd" -->
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>csajsp</shortname>
<info> A tag library from Core Servlets and JavaServer Pages, http://www.coreservlets.com/.
</info>
<tag>
<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> -->
</tag>
</taglib>

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">
<HTML>
<HEAD>
<%@ taglib uri="csajsp-taglib.tld" prefix="csajsp" %>
<TITLE><csajsp:example /></TITLE>
<LINK REL=STYLESHEET HREF="JSP-Styles.css" TYPE="text/css"> </HEAD>
<BODY>
<H1><csajsp:example /></H1>
<csajsp:example />
</BODY>
</HTML>
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; }
-->
</STYLE>
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, Example.java
package coreservlets.tags;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
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);
}
return(SKIP_BODY);
}
}
and I typed http://localhost:7001/SimpleExample.jsp in the browser window.

Thank you.
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
------------------
Simon Brown
Co-author of Professional JSP 2nd Edition
 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic