Hi all, I just wrote a very simple struts example where I am populating a combo box with some values. I use <html ptions> for populating this. First I populate just 4 values, the page loads fine but when i refresh the page I see 8 values (ie the 4 values added twice) in the html combo box. I have reset the session values etc still I am facing the same problem. Some struts expert please help... I am posting my code below...
Hi Sivaraman, Sorry for that.. u can do it either way..
1.Have a bean class ..like struts label value bean..with 2 attributes(Key and Value)...set ur dropdown values in the key and value attributes of the Bean and then add the bean in the arraylist.(u should have a new instance of the Bean every time while adding to the arrayList..hope u got my point..).Then that code should work..
2.Or else ..U can use a HashMap(lstPlace) and set the values like...HmMap.put("Chennai", "Chennai");..and set it in the Request Scope and acces it from the JSP ..Then u don't need to define any bean id..