dcsimg
Help needed with Struts ActionForm
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Brian_Boyle
Posted On:   Tuesday, February 17, 2004 02:35 PM

Hi! I am developing a voting application using EJB and Struts. When the voter logs onto the system he is shown the candidates that are running for election in his constituency/region. My problem is, that depending on the constituency the number of candidates will differ. This poses a problem with my ActionForm because each candidate has a field to vote for them and this field is mapped to a set/get method in my ActionForm. Therefore, my ACtionForm is unlikely to have the same number of set/get methods each time. Is there a way to dynamically create my ActionForm depending on the number of candidates I have? Thanks for your help, B.    More>>

Hi!


I am developing a voting application using EJB and Struts. When the voter logs onto the system he is shown the candidates that are running for election in his constituency/region. My problem is, that depending on the constituency the number of candidates will differ. This poses a problem with my ActionForm because each candidate has a field to vote for them and this field is mapped to a set/get method in my ActionForm. Therefore, my ACtionForm is unlikely to have the same number of set/get methods each time.



Is there a way to dynamically create my ActionForm depending on the number of candidates I have?




Thanks for your help,


B.    <<Less

Re: Help needed with Struts ActionForm

Posted By:   Anonymous  
Posted On:   Wednesday, February 18, 2004 12:51 AM

Hi,


in your actionforum use an arraylist as property. the arraylist is a collection of candidate objects. fill it with all candidates you want to display.


in your jsp, use the logic:iterate tag to output all candidates. use the indexed attribute of the html:text or html:checkbox tag to set the property for a certain user.


hope that helps,

andré
About | Sitemap | Contact