tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cindy Ballreich <ci...@ballreich.net>
Subject Custom Tag / JavaBean question
Date Tue, 15 Oct 2002 17:13:29 GMT

I have a custom tag that takes a collection as one of it's parameters. I'd like to be able
to give the name of an attribute (a String) as the value and have the tag find the attribute
from the pageContext. This doesn't seem like it should be too difficult. I have setters that
look like this in my tag...

  protected Collection accessList;

  public void setAccessList(String accessList) {
    Object o = pageContext.findAttribute(accessList);
    if (o instanceof Collection) {
      this.accessList = (Collection)o;
    }
  }

  public void setAccessList(Collection accessList) {
    this.accessList = accessList;
  }

...and the tag looks like this on the jsp page...

  <jsp:useBean id="accessList" scope="request" class="java.util.Vector" />
  <mpi:accessList id="access" accessList="accessList" ... >
     ...
  </mpi:accessList>

... but I keep getting errors like this...

org.apache.jasper.JasperException: Unable to convert string 'accessList' to class java.util.Collection
for attribute accessList: java.lang.IllegalArgumentException: Property Editor not registered
with the PropertyEditorManager
	at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:749)

If I use a run time value in the tag I don't get the error...

  <jsp:useBean id="accessList" scope="request" class="java.util.Vector" />
  <mpi:accessList id="access" accessList='<%= accessList %> ... >
     ...
  </mpi:accessList>

So I have a workaround for the problem, but I'd still like to understand why the first example
doesn't work when everything I've read says that it should.

I'm using Tomcat 4.1.12 on NT 4.0 (development server) with j2sdk1.4.0_01.

Thanks

Cindy



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message