Problem working with indexed properties in a struts based application on WAS 5.0.2
Joined: Oct 11, 2004
I faced very strange problem while using indexed properties in my Struts 1.1 based application. I have attached the sample code to illustrate the scenario. Application was desgined using Action Forms & Value objects. As can be seen from the code sample, my action form has MyPageVO type property along with other string type properties. Required getter/setter are provided in Action From.
MyPageVO has an indexed property: TargetVO (an ArrayList) and a string type property: UserCode. Elements of collection TargetVO are of type MyTargetVO. MyPageVO has two overloaded methods i) setTargetVO(ArrayList pobjTargetVO) Sets the property objTargetVO as a whole ii) setTargetVO(int pintIndex, Object pobjElement) Sets individual members of ArrayList objTargetVO at a given index, here pintIndex.
In the JSP, input field were to be rendered by forming their names dynamically (Please see JSP code attached) The code works fine on Windows 2000 with WebSphere Application Server enterprise edition 5.0.2 but fails (i.e. does not rendered at all) on Solaris 8 with WebSphere Application Server enterprise edition 5.0.2
After a lot of brain-storming we figured out that the overloading of setTargetVO method was causing the problem. After changing the method name in bean MyPageVO from setTargetVO(int pintIndex, Object pobjElement) to setTargetVOAtIndex(int pintIndex, Object pobjElement) and similiarly in JSP input field name from pageVO.targetVO[idx].target to pageVO.targetVOAtIndex[idx].target page was rendered correctly on Solaris as well. Though I was able to resolve the issue on solaris as well but I am unable to understand the reason, I request you all there to please help me on this strange behavior of WAS on Solaris ASAP.