dcsimg
Using arrays to store variable responses for an on-line survey using <html:radio>
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jason_Austin
Posted On:   Sunday, November 3, 2002 05:02 PM

I'm trying to develop a screen that displays a list of questions for a user to answer (on-line survey).


The number of questions asked won't always be the same. One day it could be 10 and then next it could only be 5.


I'm trying to use the control in struts but don't quite know how to map the value they select to the appropriate property in the ActionForm. I don't want to have 10 setter/getter fields for 10 predefined properties. I would much rather use an array.


Does anyone out there know how to do this?



Thanks in advance,
Jason

Re: Using arrays to store variable responses for an on-line survey using <html:radio>

Posted By:   nick_panarella  
Posted On:   Wednesday, November 6, 2002 11:22 AM

You can use struts version 1.1 and take advantage of extended form properties, which basically allow you to store all request properties in a hashMap. Or if you are using struts 1.0.2 you can create a form bean who's property name is equal to the name of your form field radio buttion, but just define this arrtibute in you formbean as an array. so the setter should take an array(ex.string[] items) as it signature variables.

Hope this helps
About | Sitemap | Contact