Well, I finally got around to playing with Tomcat 5, and everything
seems to work well except for my custom tags (which is to say my whole
web app broke :) ).  

My problem is when tomcat tries to process my custom tags I get an error
as follows:

org.apache.jasper.JasperException: /index.jsp(13,0) Unknown attribute
type (String) for attribute bar.
        
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHand
ler.java:83)
        
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java
:402)
*SNIP*

Anyone have an idea as to what might be wrong?  Keep in mind, everything
worked fine with Tomcat 4.x.  The only thing I can think of is that
perhaps this has something to do with TEI classes (which I have never
bothered with before)?  In the mean time I think I'll start slogging
through the JSP 2.0 spec, but if anyone can prevent me from thinking for
myself that would be appreciated :).
 
Thanks in Advance,

Richard Wareing
Reimer Technology Group

P.S. Here is a simple test case which demonstrates the problem (I have
it in a nice zip file with the directory structure if anyone wants it):

FooTag simply prints out the contents of a variable "bar" when it is
passed along, otherwise prints out a default message of "Nothing set!": 

/index.jsp:
================START===============

<[EMAIL PROTECTED] contentType="text/html"%>

<%@ taglib uri="/taglibs/testcase.tld" prefix="forminputs" %>


<html>
<head><title>Tomcat 5 Testcase</title></head>
<body>

<%-- <jsp:useBean id="beanInstanceName" scope="session"
class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName"  property="propertyName"
/> --%>

<forminputs:fooTag bar='<%= "Hope this works!" %>' >
<h1> <%= outputString %> </h1>
</forminputs:fooTag>


</body>
</html>

================END===============


/taglibs/testcase.tld:
================START===============
<?xml version="1.0" encoding="UTF-8" ?>

<!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>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>testcase</short-name>
    <uri>/testcase</uri>
    <display-name>testcase</display-name>
    <description>A blank tag library template. 
    </description>
    <tag>
        <name>fooTag</name>
        <tag-class>tomcat5.testcase.FooTag</tag-class>
        <body-content>JSP</body-content>
        <small-icon></small-icon>
        <large-icon></large-icon>
        <description></description>
        <!-- Forte4J_TLDX:  This comment contains code generation
information. Do not delete.
        <tldx>
            <packagename>tomcat5.testcase</packagename>
            <extendsSupportClass>TRUE</extendsSupportClass>
            <supportClass>BodyTagSupport</supportClass>
            <implementsTryCatchFinally>FALSE</implementsTryCatchFinally>
            <findparent>FALSE</findparent>
            <parenttype></parenttype>
            <parentvariable></parentvariable>
        </tldx>
        -->
        

        <variable>
            <name-given>outputString</name-given>
            <variable-class>String</variable-class>
            <declare>true</declare>
            <scope>NESTED</scope>
<!-- Forte4J_TLDX:  This comment contains code generation information.
Do not delete.
            <tldx>
                <name>outputString</name>            </tldx>
            -->
        </variable>

        <attribute>
            <name>bar</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
            <type>String</type>
            <!-- Forte4J_TLDX:  This comment contains code generation
information. Do not delete.
            <tldx>
                <javaVariable></javaVariable>
                
                <IsReferenceID>FALSE</IsReferenceID>
                <ReferencesTag>FALSE</ReferencesTag>
                <ReferenceScope>Session</ReferenceScope>
                <ReferencesTagType></ReferencesTagType>
                <ReferencesTagVariable></ReferencesTagVariable>
                
                
 
<ReferencesTagReferentFirst>TRUE</ReferencesTagReferentFirst>
            </tldx>
            -->
        </attribute>
        <example></example>
    </tag>
    
        
    <!-- Validators are new in JSP1.2. You may have zero or one
validator
         in a tag library. They look like this:
      <validator>
 
<validator-class>org.your.web.app.ValidateTaglibUsage</validator-class>
          <init-param>
             <param-name>aparameter</param-name>
             <param-value>value</param-value>
             <description>Describe this parameter</description>
          </init-param>
      </validator>
   -->

   <!-- listeners are new in JSP1.2. You may have as many listeners as
you like
        in a tag library. They look like this:
     <listener>
 
<listener-class>org.your.web.app.TaglibListener1</listener-class> 
     </listener>
   -->
</taglib>

================END===============


tomcat5.testcase.FooTag Source
================START===============

package tomcat5.testcase;

import java.io.*;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.util.*;

/**
 *  Generated tag class.
 */
public class FooTag extends BodyTagSupport {

    /** property declaration for tag attribute: selectedValue
     *
     */    
    private String bar;
    
    public FooTag() {
        super();
    }
    
    
    public void otherDoStartTagOperations()  {
    }
    
    public boolean theBodyShouldBeEvaluated()  {
        boolean retVal = false;
        if ( bar != null ) {
            setVars();
            retVal = true;
        }
        return true;
    }
    
    
    public void otherDoEndTagOperations()  {
    }
    
    public boolean shouldEvaluateRestOfPageAfterEndTag()  {
        return true;
    }
    
    
    public int doStartTag() throws JspException, JspException {
        
        otherDoStartTagOperations();
        
        if (theBodyShouldBeEvaluated()) {
            return EVAL_BODY_BUFFERED;
        } else {
            return SKIP_BODY;
        }
    }
    
    public int doEndTag() throws JspException, JspException {
        otherDoEndTagOperations();
        
        if (shouldEvaluateRestOfPageAfterEndTag()) {
            return EVAL_PAGE;
        } else {
            return SKIP_PAGE;
        }
    }
    
    public void writeTagBodyContent(JspWriter out, BodyContent
bodyContent) throws IOException {
        bodyContent.writeOut(out);
        bodyContent.clearBody();
    }
    
    public void handleBodyContentException(Exception ex) throws
JspException {
        // Since the doAfterBody method is guarded, place exception
handing code here.
        throw new JspException("error in FooTag: " + ex);
    }
    
    public int doAfterBody() throws JspException {
        try {
            BodyContent bodyContent = getBodyContent();
            JspWriter out = bodyContent.getEnclosingWriter();
            
            writeTagBodyContent(out, bodyContent);
        } catch (Exception ex) {
            handleBodyContentException(ex);
        }
        
        if (theBodyShouldBeEvaluatedAgain()) {
            return EVAL_BODY_AGAIN;
        } else {
            return SKIP_BODY;
        }
    }
    
    public boolean theBodyShouldBeEvaluatedAgain() {
        return false;
    }
    
    public java.lang.String setValueOfVariable_outputString() {
        String s = "Nothing set!";
        if ( ( bar != null) && ( bar.length() > 0 ) )
            s = bar;
        return s;
    }
    

    public void setVars() {
        //
        // Set the name and value of the scripting variable
"optionValue"
        //
        {
            //
            // The name of this variable is fixed.
            //
            String nameVar = "outputString";
            
            //
            // Set the value of the variable "timeOffset"  by modifying
the
            // method: setValueOfVariable_timeOffset().
            //
            if (nameVar != null) {
                java.lang.String valueObject =
setValueOfVariable_outputString();
                if (valueObject != null) {
                    pageContext.setAttribute(nameVar, valueObject);
                }
            }
        }

    }
    
    
    public String getBar() {
        return bar;
    }
    
    public void setBar(String bar) {
        this.bar = bar;
    }

}
================END===============


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to