On Fri, Nov 11, 2005 at 09:19:00PM +0200, Eugeny N Dzhurinsky wrote:
> Actually I'm using Tomcat 5.0 and JSTL 1.1 from Jakarta. The code looks like
> this:
> 
> <c:forEach var="obj" items="${collection}">
>     <my:custom parameter="${obj.creation_date}" />
> </c:forEach>
> 
> And the exception is JasperException, with message "-348"
        What?  Are you saying you're getting an exception that looks like this:
org.apache.jasper.JasperException: -348
???  Is there some reason you don't want to post the actual exception text?
Are there any nested exceptions?  (e.g. lines that start with "Caused by:"
and then another exception)

> I think it's because jasper container tries to cast ${obj} as Date object
        uh, no.  If there's anything going wrong with the ${obj} variable
in the code fragment you list, it might be that it doesn't have a 
creation_date property.  i.e. it's not of the type you think it is.
I've run into problems like that several times, and throwing in a
  <%= out.println("foo:" + obj) %>
will usually point out those cases.

> (setParameter method in tag takes java.util.Date as parameter)
> 
> I think i could rewrite my code in this way:
> 
> <c:forEach var="obj" items="${collection}" scope="page">
>     <jsp:useBean id="obj" class="myObject"/>
>     <my:custom parameter="<%=obj.getCreation_date()%>" />
> </c:forEach>

        You tried that and it worked?!?  That doesn't make any sense to me.
If the obj variable refers to an object of the myObject class, and that
class has a getCreation_date() method, then the reflection routines used
by the EL when resolving ${obj.creation_date} should be able to find it.
        The fact that the jsp:useBean tag didn't cause a class cast exception
means that my idea that the collection has objects of the wrong type is
not correct, so I don't know what's going wrong.

eric

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

Reply via email to