I am getting IndexOutOfBounds exception while submitting form. I will try to explain as much as possible here and then hope for a solution.
In short this is the object structure.
Project ------ worksheets(List of WorksheetDetail object) ------ parts(List of Parts objects)
So for PartName id is generated as project.worksheets.parts.name. Also project is present as a field in the form used for the page.
Now while submitting I am getting IndexOutOfBounds Exception when I submit the form. After doing some debugging I found that local server while executing getWorksheets() on Project object, empty List object is returned. Now here is the dilemma.
1) I read somewhere that this might happen when form is not found in request so at the time of submission server creates a new instance of form, with all fields initialized to default values. But do we always have to save the form object explicitly upon each request?? I don't remember having read such thing earlier (although makes sense to me). If yes, then is there any guideline on the name of the attribute to which this object should be bound ?? Is there an article, resource where I can read and understand about this concept.
2) Also Request1 is over with display of page. GUI is painted with request2, AJAX call so do I have to make sure form exists in request2 as well since this is the last request before which the page loaded.
I can give the code of the three java files but they are simple getters an setters. Also for List object fields indexed getters and setters have been defined. Any help is appreciated.
SCJP 1.4 90%, SCWCD5 94%, Next SCDJWS--> In Naescent stage. Researching abt exam and material itself.
Joined: Oct 02, 2008
Just some more information that might help you help me
1) Does the bug still exist coz I use java 1.4? I clicked on the bug link but it says its an invalid bug no.
2) I would prefer not to redefine my List fields as arrays since getters and setters are used at lots of places.
3) The object still goes deeper and have list objects. But I am sure it is failing at worksheets level an once it is resolved remaining should be resolved too.