I am having a requirement where jsp page can have variable number of elements(textbox). The value of these elements is required to pass to the database. Since number of textboxes are not fixed, i can not create a form bean for the same. How can i create a dynamic form bean which will manage dynamic form elements.
Sounds like a case for Indexed Properties. There is an entry in the FAQ that includes some links and an example that I put together. Once you get the hang of indexed properties they are pretty easy to crank out but it took me a lot of trial and error to get them working the first time.
This exception is coming when i am trying to get value of ArrayList in my Action class. As per my understanding, the form bean object while displaying values and the object while retrieving value from bean are different (as i tried to print the object's hash code in Displayaction and UpdateAction).
Below is my JSP
Bean name:-Myform Form Bean Name:- FormsMasterSearchForm
Following are the contents of FormsMasterSearchForm
I don't understand why you used a plain HTML input tag instead of a struts html:text tag as was used in Brent's sample. The techniques given in the exmaple simply won't work unless you use the Struts tag. Given how your form bean is coded, your text field should look something like this:
Note that in any Struts html:xxx tag, the styleId attribute translates to an id attribute when the HTML is rendered. [ March 15, 2008: Message edited by: Merrill Higginson ]