Hi All
See the following code
In action class I had written like
ArrayList shippers = new ArrayList();
shippers.add(new LabelValueBean("UPS", "UPS"));
shippers.add(new LabelValueBean("Federal Express", "FEDX"));
shippers.add(new LabelValueBean("AirBorne", "AIRB"));
request.setAttribute ("SHIPPERS",shippers);
And Jsp page written like
<logic:iterate id="row" name="SHIPPERS"
type="org.apache.commons.scaffold.util.LabelValueBean">
<html:radio property="expectedValue" value="<%=row.getValue()%>"/>
<bean:write name="row" property="label"/>
</logic:iterate>
the above code working fine if u select any value and click submit and
returns the same page back the selected radio button value is there .
So long as one of the values matches the "expectedVia" property on our
ActionForm, the radio tag will still automatically select the
appropriate button.
But I try to use Hash Map in the following way but, WHY IT'S NOT WORK.
Values matches the "expectedVia" property on our ActionForm, the radio
tag will not select
The appropriate value .tell me the reason.
In Action class
ArrayList shippers = new ArrayList();
for(int i=0; i<=1; i++){
HashMap map=new HashMap();
map.put("VALUE", "UPS"+i);
map.put("LABLE", "UPS"+i);
map.put("VALUE", "AIRB0"+i);
shippers.add(map);
}
request.setAttribute ("data",shippers);
in jsp I tried in the following ways to display .the selected the value
is not there the same page send returns back.
<logic:iterate id="row" name="data" type="java.util.HashMap">
<html:radio property="expectedValue" value="<%=row.get("VALUE")%>"/>
<bean:write name="row" property="label"/>
</logic:iterate>
OR
<logic:iterate id="row" name="data" type="java.util.HashMap">
<% String value=(String)row.get("VALUE"); %>
<html:radio property="expectedValue" value="<%=row.get(value)%>"/>
<bean:write name="row" property="label"/>
</logic:iterate>
OR
<logic:iterate id="row" name="data" scope="request">
<input type="radio" name="expectedVia" value="<bean:write name="row"
property="VALUE"/>"/>
<bean:write name="row" property="LABLE"/>
</logic:iterate>