problems with multiple row operations in a dataTable

Dear fellows,

I have a strange problem, i want to do multiple row deletion in a dataTable. Can any one tell me a better way to do it. Because the way i am doing it, it is causing me strange problems. In some places it start working and in some it dont.

The way i am doing it, it has the following code:

<h:form>

<h:dataTable id="list" value="#{availableRoomsList}" var="RoomTypes" >

<h:column>

<f:facet name="header">

<h:outputText value="Select"/>

</f:facet>

<h:selectBooleanCheckbox value="#{roomSelection[RoomTypes]}" >

</h:selectBooleanCheckbox>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText value="Available Date"/>

</f:facet>

<h:outputText value="#{RoomTypes.availableDate}"/>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText value="Available Rooms"/>

</f:facet>

<h:outputText value="#{RoomTypes.noOfRooms}"/>

</h:column>

</h:dataTable>

<h:commandButton value="delete Selected Rooms" action="#{RoomResvAction.deleteRooms}" />

</h:form>

Now the back end code that i am using is as follows:

private List<HotelRoomTypes> availableRoomsList;

Map<HotelRoomTypes, Boolean> roomSelection =new HashMap<HotelRoomTypes, Boolean>();

/*--*/

public String deleteRoom(){

System.out.println("In the delete selection method aad.");

try{

for (HotelRoomTypes item: availableRoomsList){

Boolean selected = roomSelection.get(item);

if (selected!=null && selected){

roomSelection.put(item,false);

//deleteRoom(item);

}

}

}catch(Exception e){

//e.printStackTrace();

}

returnnull;

}

The problem with the JSF code is when i click the command button it do not calls the associated action method with it. i dont know what is the problem with the code.

And as far as the backend code is concern it should work fine.

can anybody help me on this matter.

[3320 byte] By [saifulislamkhana] at [2007-11-26 21:32:16]
# 1
I haven't seen this approach earlier. Where did you get it from?Well, the CRUD example here might be interesting: http://balusc.xs4all.nl/srv/dev-jep-dat.html
BalusCa at 2007-7-10 3:12:57 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
thanks BalusC ,I will see this example and let you know, thanx for the help.but also please try and see my code and tell me what is wrong in it. because at some places it works and at some it simply dont . dont know why?well once again thanx for the help
saifulislamkhana at 2007-7-10 3:12:57 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
When doesn't it work then?
BalusCa at 2007-7-10 3:12:57 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...