See intermixed

> -----Original Message-----
> From: Jeremy Cavagnolo [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, January 20, 2003 7:31 PM
> To: [EMAIL PROTECTED]
> Subject: ClassCastException problem
> 
> 
> I am using struts 1.0.2 and tomcat 4.1.12.  I have an Action 
> that contains the following code:
> 
> import org.alf.msq.data.Problem;
> 
> ...
> 
> public ActionForward perform(...)
> {
> ...
>    ArrayList problemArray = new ArrayList();
>    problemArray.add(new Problem("1E"));
>    problemArray.add(new Problem("1I"));
>    problemArray.add(new Problem("1A"));
>    request.setAttribute("problemArray", problemArray);
> ...
> 
>    return (mapping.findForward("probSelect"));
> }
> 
> 
> In probSelect.jsp, The following works:
> 
> <logic:iterate name="problemArray" id="currentProb" scope="request">
>    <bean:write name="currentProb" property="problemName"/> 
> </logic:iterate>
> 
> However, if I try to add type="org.alf.msq.data.Problem" I 
> get a ClassCastException.
> 

If it's working, why are trying to specify the type?  Where are you trying to set the 
type?  On the <logic:iterate>?  

> I have tried casting an element of problemArray back to 
> org.alf.msq.data.Problem in the jsp using every way I can 
> think of and I always get the ClassCastException.  Casting 
> works correctly with other objects (like String), but none of 
> my Objects.  Casting of these objects works fine in all other 
> java code too.  I added the following to my Action class and 
> it worked fine:
> 
> ArrayList testArray = (ArrayList)request.getAttribute("problems");
> Problem prob = (Problem)testArray.get(0);
> 
> I must be missing something huge here.  Any help is greatly 
> appreciated.

Is your struts.jar in your application's WEB-INF/lib and *not* in any of the other 
locations where it might get picked by the other Tomcat classloaders?  I admit, 
however, that even if this *were* the case you are more likely to get a 
ClassNotFoundException.

Sorry I don't have any clear cut answers.

> 
> Sincerely,
> 
> Jeremy

Sri

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

Reply via email to