With all the features of Struts 1.1 and 1.1-beta, why do you continue in this direction?
Am I missing something? I can create a 5 page wizard and never write a single line of ActionForm code. Help me if I am misunderstanding. JM P.S. Shouldn't this be asked in the [EMAIL PROTECTED]??? > -----Original Message----- > From: Thorbjoern Andersen [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 29, 2002 8:19 AM > To: Struts Users Mailing List > Subject: Beans constructed with BCEL makes html:option throw > ClassCastExceptionin Struts 1.0.2 > > > As mentioned on this list previously I have, with great labour, written > a class which generates beans on the fly using BCEL based on a > user-provided Property mapping field-named to field-types. > > This now works well, but my first attempt on using these beans with > Struts have failed with the error message quoted at the end of this > message, which indicates to me that I have missed some part here. > > I have an ArrayList of my beans, where this code works nicely: > > { > java.util.ArrayList al = > abf.createBeanArrayList(stmt.executeQuery( "select distinct donor_ab0 > from ab0_rules order by donor\ > _ab0")); > pageContext.setAttribute( "bloodTypes", al); > java.util.ListIterator i = al.listIterator(); > while( i.hasNext()) { > Object o = i.next(); > out.println( o + " : " + BeanUtils.describe( o) + "<br>"); > } > } > > and prints out the following: > > org.scandiatransplant.anonybeans.Xcc416f1298d2f3e4.3e9584e0f1d96d@415727 > : {donor_ab0=0, class=class > org.scandiatransplant.anonybeans.Xcc416f1298d2f3e4.3e9584e0f1d96d} > > org.scandiatransplant.anonybeans.Xcc416f1298d2f3e4.3e9584e0f1d96d@c0fc8e > : {donor_ab0=A, class=class > org.scandiatransplant.anonybeans.Xcc416f1298d2f3e4.3e9584e0f1d96d} > ... > > But when I want to use it with Struts 1.0.2 in the construct > > ... > <html:select property="bloodType"> > <html:options collection="bloodTypes" property="donor_ab0" > labelProperty="donor_ab0"/> > </html:select> > ... > > it fails as described. If it is related, I have found that I can easily > cast the result of "bean.newInstance()" to an Object, but not to a > Class. > > Any thoughts on how to fix this would be appreciated. I am so close to > making this work :-) > > > > > The error message is as follows > > java.lang.IllegalArgumentException: java.lang.ClassCastException@4649ed > at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc > cessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > org.apache.struts.util.PropertyUtils.getSimpleProperty(PropertyUti > ls.java:717) > at > org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUti > ls.java:426) > at > org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:453) > at > org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:202) > at _k__jsp._jspService(/k1/k.jsp:146) > at com.caucho.jsp.JavaPage.service(JavaPage.java:74) > at com.caucho.jsp.Page.subservice(Page.java:485) > at > com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:179) > at com.caucho.server.http.Invocation.service(Invocation.java:288) > at > com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:132) > at > com.caucho.server.http.ServletServer.serviceTop(ServletServer.java:937) > at > com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:213) > at > com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:158) > at com.caucho.server.TcpConnection.run(TcpConnection.java:140) > at java.lang.Thread.run(Thread.java:536) > > > > > -- > Thorbjoern Ravn Andersen > Scandiatransplant, c/o Christian Mondrup > 89 49 53 01 > http://biobase.dk/~tra > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

