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.

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.

Sincerely,

Jeremy


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

Reply via email to