You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mohamed ebrahim faisal <eb...@hotmail.com> on 2003/10/24 13:27:23 UTC
logic tags
E.FAISAL
Hi
I would like to display the form data in JSP using logic:iterate tags.
Consider the following situation
ArrayList ar = form.getInfoContents();
for(int i=0;i<ar.length;i++)
{
HashMap row = (HashMap) ar.get(i);
<tr>
<td><html:text property="name" value="<%=(String) row.get("name") %>" />
<td><html:text property="age" value="<%=(String) row.get("age") %>" />
<td><html:text property="address" value="<%=(String) row.get("address")
%>" />
...............
..................
</tr>
}
In the above code i am getting a property of type ArrayList whose elements
are of type HashMap, where each HashMap object represents a record.
It works fine , but i want above code purely in struts tag logic:iterate or
some other technique.
I tried the following and it worked fine
<logic:iterate name="beanname" id="persons" property="infoContents">
<tr>
<logic:iterate name="persons" id="row" >
<td>
<bean:write name="row" />
</td>
</logic:iterate>
</tr>
</logic:iterate>
But in the above case i am not able to associate every value in the HashMap
object ie, "row" to a corresponding property like i got using for loop
tr>
<td><html:text property="name" value="<%=(String) row.get("name") %>" />
<td><html:text property="age" value="<%=(String) row.get("age") %>" />
<td><html:text property="address" value="<%=(String) row.get("address")
%>" />
...............
..................
</tr>
please someone help me out and give the approach to solve the problem
regards
faisal
_________________________________________________________________
Access Hotmail from your mobile now.
http://server1.msn.co.in/sp03/mobilesms/ Click here.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: logic tags
Posted by Brad Balmer <bb...@peapod.com>.
Have you looked at the DisplayTag Libray?
http://sourceforge.net/projects/displaytag/
mohamed ebrahim faisal wrote:
>
>
>
>
> E.FAISAL
>
>
> Hi
>
> I would like to display the form data in JSP using logic:iterate
> tags.
>
> Consider the following situation
>
> ArrayList ar = form.getInfoContents();
>
> for(int i=0;i<ar.length;i++)
> {
> HashMap row = (HashMap) ar.get(i);
> <tr>
> <td><html:text property="name" value="<%=(String) row.get("name")
> %>" />
> <td><html:text property="age" value="<%=(String) row.get("age") %>" />
> <td><html:text property="address" value="<%=(String)
> row.get("address") %>" />
>
> ...............
> ..................
> </tr>
> }
>
> In the above code i am getting a property of type ArrayList whose
> elements are of type HashMap, where each HashMap object represents a
> record.
>
> It works fine , but i want above code purely in struts tag
> logic:iterate or some other technique.
>
> I tried the following and it worked fine
>
> <logic:iterate name="beanname" id="persons" property="infoContents">
> <tr>
> <logic:iterate name="persons" id="row" >
> <td>
> <bean:write name="row" />
> </td>
> </logic:iterate>
> </tr>
> </logic:iterate>
>
> But in the above case i am not able to associate every value in the
> HashMap object ie, "row" to a corresponding property like i got using
> for loop
>
> tr>
> <td><html:text property="name" value="<%=(String) row.get("name")
> %>" />
> <td><html:text property="age" value="<%=(String) row.get("age") %>" />
> <td><html:text property="address" value="<%=(String)
> row.get("address") %>" />
>
> ...............
> ..................
> </tr>
>
> please someone help me out and give the approach to solve the problem
>
>
> regards
>
> faisal
>
> _________________________________________________________________
> Access Hotmail from your mobile now.
> http://server1.msn.co.in/sp03/mobilesms/ Click here.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org