| Author |
How to handle checkbox in jsf
|
saravana kumar
Greenhorn
Joined: May 14, 2007
Posts: 12
|
|
Hi All, I am new to JSF framework. I have the following requirement From the listing screen i have to select one or more record to perform delete operation thru checkbox. Can anyone tell me how to identify the selected records in jsf without using javascript... Thanks for any help. Regards, Saravanan
|
 |
John Bartlett
Ranch Hand
Joined: Jan 25, 2006
Posts: 116
|
|
Hi, You will need to be more specific, where are you storing these records? In a datatable? John
|
 |
saravana kumar
Greenhorn
Joined: May 14, 2007
Posts: 12
|
|
Hi, Please loot at the sample code in jsf <h:dataTable var="adminList" id="mytable" value="#{messageList}" border="1" style="background-color:silver"> <h:column> <f:facet name="header"> <h utputText value="Select All"/> </f:facet> <h:selectBooleanCheckbox value="{adminList.selected}"/> </h:column> <h:column> <f:facet name="header"> <h utputText value="User Id"/> </f:facet> <h:commandLink action="#{userManager.editAdmin}" > <h utputText value="#{adminList.userId}"/> </h:commandLink> </h:column> <h:column> <f:facet name="header"> <h utputText value="User Name"/> </f:facet> <h utputText value="#{adminList.userName}"/> </h:column> <h:column> <f:facet name="header"> <h utputText value="Phone Number"/> </f:facet> <h utputText value="#{adminList.phoneNumber}"/> </h:column> <h:column> <f:facet name="header"> <h utputText value="Email Id"/> </f:facet> <h utputText value="#{adminList.emailAddress}"/> </h:column> <h:column> <f:facet name="header"> <h utputText value="Role"/> </f:facet> <h utputText value="#{adminList.role}"/> </h:column> </h:dataTable> Regards Saravanan
|
 |
John Bartlett
Ranch Hand
Joined: Jan 25, 2006
Posts: 116
|
|
To get this to work i normally bind the data table into my bean and then access the row via the getRowIndex() on that bound in table. e.g. Add this attribute (and appropriate getter/setter methods) to your bean then add this to your datatable declaration in the xhtml - now that you have the component bound into your bean, in you action method where you are deleting. you can just do this Now you have the selected message to delete.... Is this close to what you want to do? [ June 07, 2007: Message edited by: John Bartlett ]
|
 |
saravana kumar
Greenhorn
Joined: May 14, 2007
Posts: 12
|
|
Hi, Ya this is what i was expecting. Thank you. Regards, Saravanan
|
 |
 |
|
|
subject: How to handle checkbox in jsf
|
|
|