| Author |
populating list box
|
Rajeev Ravindran
Ranch Hand
Joined: Aug 27, 2002
Posts: 455
|
|
Hi, Could somone help me with solving this issue. I couldnt find much help after googling and after searching this forum on JR. I am not sure if im doing something real stupid or not but all the examples i found will throw some exception. I am trying to display a listbox with some values. This is my action class code
ArrayList myList = new ArrayList(); for( int i=0; i<10 ; i++ ) { myList.add( new LabelValueBean("Label of "+ i ," value of " +i)); } request.getSession().setAttribute( "DisplayList", myList );
In my JSP i have
<bean:define id="answerList" name="QuestionVO" property="DisplayList" scope="session" type="java.util.ArrayList" /> <html:select name="myForm" property="answerValue" > <html  ptions collection="answerList" property="label" labelProperty="label"/> </html:select>
When i run the application im getting the following error
Any help is appretiated. Thanks, Rajeev [ October 31, 2006: Message edited by: Rajeev Ravindran ]
|
SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Remove the <bean:define> tag. You don't need it. Then specify collection="DisplayList" in your <html ptions> tag.
|
Merrill
Consultant, Sima Solutions
|
 |
Rajeev Ravindran
Ranch Hand
Joined: Aug 27, 2002
Posts: 455
|
|
Thanks for your reply Merrill. I am more into JSF and now i have to do some enhancement to the exisiting struts app. Your suggestion helped me, i had to define the property in ActionForm too. I may comeup with more silly questions later ! Thanks again, Rajeev
|
 |
 |
|
|
subject: populating list box
|
|
|