A coworker claims this is a bug in reflection when used to introspect any class called 
"Component" - it always thinks it's java.awt.Component. YMMV.

> -----Original Message-----
> From: Chen, Gin [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 27, 2003 3:38 PM
> To: 'Struts Users Mailing List'
> Subject: RE: is Component a reserved word?
> 
> 
> Will it is in his classpath indirectly it is not in his jsp 
> unless he did a
> import of it.
> So it looks like this is another issue.
> Unless there is a component besides java.awt.Component that I 
> don't know of.
> -Tim
> 
> -----Original Message-----
> From: Andy Kriger [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 27, 2003 3:33 PM
> To: Struts Users Mailing List
> Subject: RE: is Component a reserved word?
> 
> 
> java.awt.Component is also in your classpath
> maybe c:out is trying to cast your object as that instead of
> x.y.z.Component?
> 
> -----Original Message-----
> From: John Thorhauer [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 27, 2003 15:18
> To: Struts Users Mailing List
> Subject: is Component a reserved word?
> 
> 
> Hi,
> 
> I am not sure if this is a struts, taglib, or jstl issue but I will
> start here.  I am using Struts/JSP's and am running into an 
> error when I
> try and reference my own object called Component.class with <c:out>
> tag.  I first load my test objects into the session in the 
> jsp page like
> this:
> 
> <%
> x.y.z.Component component = new x.y.z.Component();
> 
> x.y.z.Xomponent xomponent = new x.y.z.Xomponent();
> 
> session.setAttribute("comp2",component);
> session.setAttribute("xomp2",xomponent);
> 
> %>
> 
> Next I try and view the value of the name like this:
> 
> <c:out value="${comp2.name}"/>
> 
> Here is the error I am getting:
> 
> org.apache.jasper.JasperException: An error occurred while evaluating
> custom action attribute "value" with value "${comp2.name}": An error
> occurred while getting property "name" from an instance of class
> x.y.z.Component (java.lang.IllegalArgumentException: object is not an
> instance of declaring class)
> 
> I have played around with this a bit and set up a small test
> environment.  Here is my application list:
> 
> Tomcat 4.1.18
> Struts 1.1 rc1
> Java 1.3.1_06-b01
> 
> I have found that I can use the Runtime JSTL core tag like this and it
> works fine:
> 
> <crt:out
>    value="<%=((Component)session.getAttribute("comp2")).getName()%>"/>
> 
> I can also use the <jsp:useBean> tag like this and it works fine:
> <jsp:getProperty name="comp1" property="name"/>
> 
> I have also found that if I take the exact same class and 
> simply rename
> it to Xomponent instead of Component and keep it in the same x.y.z
> package, it works.  So I can then do:
> <c:out value="${xomp2.name}"/>
> 
> Any ideas on this?  I have my very small test beans and jsp page if
> someone needs them.
> 
> Thanks,
> John
> --
> ********************************
> ** John Thorhauer
> ** Web Developer
> ** Phoenix Color Corp.
> ** [EMAIL PROTECTED]
> ********************************
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

Reply via email to