You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Paul Daniell <pd...@ign.com> on 2004/01/26 21:55:00 UTC
possible bug in struts?
I've encountered a strange problem with Struts when used with Torque. I
retrieve an object using the following:
ArrayList list = (ArrayList)ComponentPeer.doSelect(new Criteria());
request.setAttribute("components", list);
Component c = (Component)list.get(0);
request.setAttribute("comptest", c);
System.out.println(c.getName());
In the logs this will appropriately print the name of the object "c".
However, when I invoke the following JSP
...
<html><body>
<c:out value="${comptest.name}"/>
</body></html>
I get the following Exception:
HTTP ERROR: 500 An error occurred while evaluating custom action attribute
"value" with value "${comptest.name}": An error occurred while getting
property "name" from an instance of class
org.ttemplating.internal.dataobjects.Component
(java.lang.IllegalArgumentException: object is not an instance of declaring
class)
Any advice appreciated.
Paul
Re: possible bug in struts?
Posted by Frederico Augusto Costa <fa...@terra.com.br>.
Did you import your class in JSP?
----- Original Message -----
From: "Paul Daniell" <pd...@ign.com>
To: "Struts Developers List" <st...@jakarta.apache.org>
Sent: Monday, January 26, 2004 6:55 PM
Subject: possible bug in struts?
I've encountered a strange problem with Struts when used with Torque. I
retrieve an object using the following:
ArrayList list = (ArrayList)ComponentPeer.doSelect(new Criteria());
request.setAttribute("components", list);
Component c = (Component)list.get(0);
request.setAttribute("comptest", c);
System.out.println(c.getName());
In the logs this will appropriately print the name of the object "c".
However, when I invoke the following JSP
...
<html><body>
<c:out value="${comptest.name}"/>
</body></html>
I get the following Exception:
HTTP ERROR: 500 An error occurred while evaluating custom action attribute
"value" with value "${comptest.name}": An error occurred while getting
property "name" from an instance of class
org.ttemplating.internal.dataobjects.Component
(java.lang.IllegalArgumentException: object is not an instance of declaring
class)
Any advice appreciated.
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org
Re: possible bug in struts?
Posted by Joe Germuska <Jo...@Germuska.com>.
This question is probably better directed at the struts-user list.
However, I don't believe that request attributes can be directly
de-referenced with JSTL expressions; you would need to either use
c:set to create a page-scoped var named "comptest" or reference it
through an expression that caused the JSTL EL to look in the request.
Joe
At 12:55 PM -0800 1/26/04, Paul Daniell wrote:
>I've encountered a strange problem with Struts when used with Torque. I
>retrieve an object using the following:
>
>ArrayList list = (ArrayList)ComponentPeer.doSelect(new Criteria());
>request.setAttribute("components", list);
>Component c = (Component)list.get(0);
>request.setAttribute("comptest", c);
>System.out.println(c.getName());
>
>In the logs this will appropriately print the name of the object "c".
>However, when I invoke the following JSP
>...
><html><body>
><c:out value="${comptest.name}"/>
></body></html>
>
>
>I get the following Exception:
>
>HTTP ERROR: 500 An error occurred while evaluating custom action attribute
>"value" with value "${comptest.name}": An error occurred while getting
>property "name" from an instance of class
>org.ttemplating.internal.dataobjects.Component
>(java.lang.IllegalArgumentException: object is not an instance of declaring
>class)
>
>Any advice appreciated.
>Paul
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Imagine if every Thursday your shoes exploded if you tied them
the usual way. This happens to us all the time with computers, and
nobody thinks of complaining."
-- Jef Raskin
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org