Forums Register Login

How to pass collection as an attribute to Tag File

+Pie Number of slices to send: Send
(Env: Tomcat 5.5.9)
I want to pass the collection object which is saved in the request to Tag file via attribute. Something like this:
jsp:
<tag1:showBook bookList="${myBookList}" />

tag file (tag1.tag)
<%@ attribute name="bookList" type="java.util.Collection" %>

But it throws the exception:
org.apache.jasper.JasperException: jsp.error.beans.property.conversionorg.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)

I looked into translated jsp code. The EL was not translated. "${myBookList}" is only taken as a String.

Please shed some lights on it. Thanks in advance.
allan
[ May 24, 2005: Message edited by: Allan Wang ]
+Pie Number of slices to send: Send
 

The EL was not translated.



Is EL translated elsewhere on the page?
+Pie Number of slices to send: Send
Yes. EL was translated correctly elsewhere on the page.

Now I think the question is whether we can pass a collection as an attribute to custom Tag file. In the other word, can I specify 'type="java.util.Collection' in the declaration of attribute in the tag file? It looks to me Tomcat doesn't support this type.
+Pie Number of slices to send: Send
Thanks Bear. Finally I figured out the problem is from the version of J2EE and JSTL. My IDE automatically specified the version of Servlet to 2.2 and I've been mistakenly using JSTL 1.0 (my declare was <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>, it should be <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> . After I corrected these version issues, everything works perfectly.


[ May 25, 2005: Message edited by: Allan Wang ]
The only cure for that is hours of television radiation. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2177 times.
Similar Threads
How to dynamically evaluate a tag within a java file
Question on JSP Tags
JSPFragment
Passing ArrayList to JSP custom Tag?
Tag file variable question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:09:33.