Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Not a Bug
-
Affects Version/s: Release 1.4.3
-
Fix Version/s: Release 1.5
-
Component/s: Tag Library
-
Labels:None
-
Environment:Tomcat 6.0.13, Safari + Firefox on Mac OSX 10.5.1
Description
I have a form that dynamically creates controls so that multiple values for the same field can be entered. In the action bean after binding and validation is done, I remove null values from the list so that empty inputs aren't presented to the user. After this is done and the page is rendered again (say after validation of other fields), the values in the indexed text boxes are not rendered properly.
I have built a simple application to replicate the problem.
1) Deploy the attached WAR file
2) Access it under the context /StripesBug
3) Click on the + button 4 times. You will see 4 text fields each containing a value from names[0] through names[3].
4) Click the test button. The page will be redrawn with the same values in all 4 input fields, and then next to the in static text.
5) Click on the - button next to names[1], leaving names[0], names[2] and names[3]
6) Click the test link - you will now see 3 text boxes with names[0], names[2], names[2] in the input fields, but their real values from the iterator next to them in bold - names[0], names[2], names[3]. What has happened here is the action bean has removed the null value from position 1 in the index list and moved 2 & 3 back. When the page re-draws, it is getting the old value for position 2 (names[2]) not the new value (names[3]).
As a control, I have included a page /StripesBug/index_1.jsp which doesn't use the stripes:text control, just a normal html input with the attributes set the way stripes generates them. Follow the same steps as above on this page and in step 6 you will see the input fields contain names[0], names[2], names[3] - matching the static text printed next to them.
Can be deployed to show the bug. Contains Stripes 1.4.3, and JSTL 1.1 libraries.