Hi Struts users:

I'm working with Struts 2 (v 2.1.6) and I have the following problem:

I have a list of notifications, which I display in a table in a jsp:



<s:iterator value=*"notificationList"* var=*"notification"*>

<tr>

<td scope=*"row"*><s:checkbox name=*"notificationIdList"* value=*
"%{selected}"* fieldValue=*"%{notificationId}"*/></td>

<td scope=*"row"*><s:property value=*"notificationName"*/></td>

</tr>

</s:iterator>

<s:submit action=*"markNotifications"* value=*""*>



As you can see, each notification has a checkbox: if the user selects a
notification, its Id is sent to the action.

So in my action I have a List<Long> notificationIdList (with getters &
setters) to receive all the Id's of the notifications selected by the user.

I iterate this list to operate with the notification id's received:



Iterator<Long> iter=*notificationIdList*.iterator();

*while*(iter.hasNext()){ Long notificationId=iter.next(); ....



When I debug the action, in my List<Long> notificationIdList I get a
XWorkList with the id's of the notifications selected and everything is
right,

but if no notification was selected, in the XWrokList I get a
[ognl.NoConversionPossible]
(NOT a NULL!!!) and when I try Long notificationId=iter.next();

it throws an exception...



Anyone knows a workaround for this? In this case, I want to show a message
to the user, warning him that at least he has to select one notification.

Thanks in advace,

Sr.Ilustre.

Reply via email to