Weird thing at <bean:define> (probably a tomcat error - I use
tomcat 3.2.1 with the IBM jdk 1.3 on linux): 

Here is a sample JSP (copied from the "Bean User Guide"):

----------
<%@page language="java" contentType="text/html;charset=ISO-8859-1"%>

<%@ taglib uri='/WEB-INF/struts-bean.tld' prefix='bean' %>

<bean:define id="last" scope="session" value='<%= request.getRequestURI() %>'/>
<bean:write name="last" />
----------

and here is the result:

----------
Error: 500

Location: /matademo/WEB-INF/jsp/main.jsp

Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile class for JSP
        at java.lang.Throwable.(Throwable.java:96)
        at java.lang.Exception.(Exception.java:44)
        at javax.servlet.ServletException.(ServletException.java)
        at org.apache.jasper.JasperException.(JasperException.java)

... etc. The relevant portion comes here:

Root cause: 

java.lang.ClassCastException: java.lang.Object
        at javax.servlet.jsp.tagext.TagData.getAttributeString(TagData.java)
        at org.apache.struts.taglib.bean.DefineTei.getVariableInfo(DefineTei.java:89)
        at javax.servlet.jsp.tagext.TagInfo.getVariableInfo(TagInfo.java)
----------

The offending code seems to be pretty innocent:

// from org.apache.struts.taglib.bean.DefineTei.java:

    public VariableInfo[] getVariableInfo(TagData data) {

        String type = data.getAttributeString("type");
        if (type == null) {
            if (data.getAttributeString("value") != null) //****  Line 89
                type = "java.lang.String";
            else
                type = "java.lang.Object";
        }

----------

As a temporary measure I give type attribute at bean:define and it works.

----------
<%@page language="java" contentType="text/html;charset=ISO-8859-1"%>

<%@ taglib uri='/WEB-INF/struts-bean.tld' prefix='bean' %>

<bean:define id="last" scope="session"
      type="java.lanf.String"
      value='<%= request.getRequestURI() %>'/>
<bean:write name="last" />
----------

=========================================================================
OFF TOPIC:

In tomcat 3.2.1 there are a couple of "showstopper" errors (e.g.
getUserPrincipal().getName() overlives sessions and sticks to the
first logged in user, I have illegal access exceptions if I want
to prepare struts bean variable from request, e.g.

<bean:page id="req" property="request" />
<bean:write name="req" property="pathInfo" /> bombs with illegal access
exception

etc.)
=========================================================================

So, the question. Doea anybody experiance these things in other
environments or these are simply Tomcat bugs (in this case I will
report it there). (OFF TOPIC: does anybody know when do we have
a next bug fix release of Tomcat. I'd like to use it, but it's
almost impossible at the moment - Imean: too much workaround).
know when will be a release o

Tia                                                              incze

Reply via email to