Hi Ranchers,
Im facing problems with my dropdown list population in Struts 1.x version.
Please find the below code.I need your help ranchers to resolve this problem.
Please tell me how should i populate the values from the list named "ListData" on to the jsp page i.e how should the Country Dropdown be populated
Please help me since i have been struggling to get this right.
Let me know what are you trying to display.
Name? or id? ---> I want to display name
By the way try to follow naming conventions when declaring Variable. --- Ok got it
Use camelCase when the variable has more than one word or else start with lowercase letter if the variable name is singe word.
[code]
But why this statement lies outside while loop
m.setXYZDropDownList(XYZDropDownValues);
The above statement is outside while loop because once my list is constructed i will set it into a Pojo object......Hope it clarifies -->Please correct me if im wrong.
XYZPOJO class has two attributes moduleid,XYZDropdownList.I do not know where you are setting the value for both of these attributes.
Then inside while loop you are retrieving first XYZPojo object and displaying module id(So it seems the POJO object has been initialized somewhere only with module id not with the XYZDropDownlist.Then you are constructing XYZDropDownlist by passing the id and module id as the attribute.So id will be stored in id and module id will be stored as name in the XYZDropDwonlist class.Now,if you want to assign value to the XYZDropdownList attribute of the POJO class then you should have that statement inside the while loop so that the Object is completly initalized with List attribute inthe POJO class.
Will the above code which you have pasted work???
May be. I still did not understand why do you have List attribute in your POJO class.
Let me know the full operation so that i can help you.