Hi paulsmoody
This just a sample program I know UI labels are not good, Hard coded in
Action class.
Main problem is value="<%=row.get("VALUE")%>" line not complied in JSP
page why?
<logic:iterate id="row" name="data" type="java.util.HashMap">
<html:radio property="expectedVia" value="<%=row.get("VALUE")%>"/>
</logic:iterate>
-----Original Message-----
From: Paul Moody [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 19, 2005 3:38 PM
To: Struts Users Mailing List
Subject: RE: Problem in Struts Tags
I would expect you to have a problem with the jsp. You
have an ArrayList with each element being a Map. When
you iterate over the ArrayList with the logic:iterate
tag each element, identified by "row", is a Map. This
means that the "<bean:write name="row"
property="label"/>" will fail because there is no
getLabel method for the Map.
You could try a <%=row.get("LABEL)%> to get the stored
label from the Map which should work.
However, I am not sure this is the best solution as
you are coding your UI labels in your Action which is
not best practice as far as I know.
Hope this was of help.
Paul Moody
--- raghavendra <[EMAIL PROTECTED]> wrote:
>
> Please first under stand the problem, the problem in
> jsp page. Why the
> jsp page does't complile. Try the following code in
> u r system.
>
> <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>
>
>
> -----Original Message-----
> From: Marsh-Bourdon, Christopher
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 19, 2005 3:21 PM
> To: 'Struts Users Mailing List';
> [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: Problem in Struts Tags
>
> You are adding the HashMap as an item to the
> ArrayList, not replacing
> the
> contents of the ArrayList with the contents of the
> HashMap. Try this:
>
> List shippers = new ArrayList(map);
>
> Instead of:
>
> shippers.add(map);
>
> And get rid of:
>
> ArrayList shippers = new ArrayList();
>
> Cheers
>
> Christopher Marsh-Bourdon
> www.marsh-bourdon.com
>
> -----Original Message-----
> From: raghavendra
> [mailto:[EMAIL PROTECTED]
> Sent: 19 July 2005 10:55
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED];
> [email protected]
> Subject: Problem in Struts Tags
>
>
> 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>
>
>
>
>
------------------------------------------------------------------------
> --------
> The information contained herein is confidential and
> is intended solely
> for the
> addressee. Access by any other party is unauthorised
> without the express
>
> written permission of the sender. If you are not the
> intended recipient,
> please
> contact the sender either via the company
> switchboard on +44 (0)20 7623
> 8000, or
> via e-mail return. If you have received this e-mail
> in error or wish to
> read our
> e-mail disclaimer statement and monitoring policy,
> please refer to
> http://www.drkw.com/disc/email/ or contact the
> sender. 3166
>
------------------------------------------------------------------------
> --------
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with
voicemail http://uk.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]