You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marco Mistroni <mm...@waersystems.com> on 2006/06/02 11:09:16 UTC
Logic:Iterate & HashMap
Hi all,
I m having a problem with logic:iterate
I have a Map that contains {String, MyDTO}
In my jsp I m writing following code;
<logic:iterate name="<%= MyMap %>" id="stock">
<tr>
<td><bean:write name="stock" property="key"/></td>
<td><bean:write name="stock"property="value.allocatedQuantity"/></td>
<td><bean:write name="stock"
property="value.freeQuantity"/></td>
<th>0</th>
<th>0</th>
</tr>
</logic:iterate>
Struts complaints that 'No allocatedQuantity property found on bean 'stock'
But it is in my DTO!!!!
Am I missing something?
Thanks and regards
marco
-----Original Message-----
From: marcus biel (innoWake gmbh) [mailto:marcus.biel@innowake.de]
Sent: 01 June 2006 15:50
To: Struts Users Mailing List
Subject: Validating in Action?
Hi,
I got a JSP, form and Action.
I want to add 3 values into an database.
This is done in my action.
The problem: I am using a Service to add the stuff to the db,
and when using this service, it throws error messages
like "artikel not found" or "project not found".
Now I want to display these errors to the user -
The problem is I can't do those error validation in my ActionForm,
because only after doing the action I will know wether or not it
succeeded -
so how can I then set the appropiate errormessages and forward to the
jsp?
Thanks,
Marcus
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Logic:Iterate & HashMap
Posted by Monkeyden <mo...@gmail.com>.
Use the name and property attributes in your iterate tag, where "name" is
the name of your DTO and "property" is the name of the Map within the DTO.
You can have a look at the docs here:
http://struts.apache.org/struts-doc-1.2.7/userGuide/struts-logic.html
On 6/2/06, Marco Mistroni <mm...@waersystems.com> wrote:
>
> Hi all,
> I m having a problem with logic:iterate
>
> I have a Map that contains {String, MyDTO}
>
> In my jsp I m writing following code;
>
> <logic:iterate name="<%= MyMap %>" id="stock">
> <tr>
> <td><bean:write name="stock" property="key"/></td>
> <td><bean:write name="stock"property="value.allocatedQuantity"/></td>
> <td><bean:write name="stock"
> property="value.freeQuantity"/></td>
> <th>0</th>
> <th>0</th>
>
> </tr>
> </logic:iterate>
>
> Struts complaints that 'No allocatedQuantity property found on bean
> 'stock'
>
> But it is in my DTO!!!!
>
> Am I missing something?
>
> Thanks and regards
> marco
>
>
>
>
> -----Original Message-----
> From: marcus biel (innoWake gmbh) [mailto:marcus.biel@innowake.de]
> Sent: 01 June 2006 15:50
> To: Struts Users Mailing List
> Subject: Validating in Action?
>
> Hi,
>
> I got a JSP, form and Action.
> I want to add 3 values into an database.
> This is done in my action.
> The problem: I am using a Service to add the stuff to the db,
> and when using this service, it throws error messages
> like "artikel not found" or "project not found".
> Now I want to display these errors to the user -
>
> The problem is I can't do those error validation in my ActionForm,
> because only after doing the action I will know wether or not it
> succeeded -
> so how can I then set the appropiate errormessages and forward to the
> jsp?
>
>
> Thanks,
>
> Marcus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>