| Author |
how to set the value of the primary key to the check box in data table
|
sumi aces
Greenhorn
Joined: Oct 20, 2008
Posts: 1
|
|
Hai, Any one please help me to solve this out.. A Data Table with first column has checkboxes and second column with the primary key (ex: empno) of the database in the server. I need to set the value of the checkbox as the corresponding primary key, so that when the particular row checkbox is checked and when i click the delete button, the corresponding primary key and its records has to get deleted from the database. I've created my jsf page for checkbox as, <h:column id="col1"> <f:facet name="header"> <h utputLabel id="lblchange" value="Select" /> </f:facet> <h:selectBooleanCheckbox id="chkid" value="#{planGroup.chkValue}"> </h:selectBooleanCheckbox> </h:column> <h:column id="column1"> <f:facet name="header"> <h utputText value="Plan Group ID"></h utputText> </f:facet> <h utputText value="#{result.planGroupId}"></h utputText> <h:inputHidden id="planGroupList" value="#{result.planGroupId}" /> </h:column> bean : public class PlanGroupBean { private String planGroupID; private boolean chkValue; public boolean isChkValue() { //System.out.println("CHECKED--CHK-value:"+chkValue); return chkValue; } public void setChkValue(boolean chkValue) { this.chkValue = chkValue; } public void setPlanGroupID(String planGroupID) { this.planGroupID = planGroupID; } public String getPlanGroupID() { return this.planGroupID; } } I don't know how to set the value of primary key to the check box... please help me out...
|
 |
Himanshu Gupta
Ranch Hand
Joined: Aug 18, 2008
Posts: 598
|
|
You can do one thing to do it. Use <f:param> so that whenever you will get request you can take the id from it. <h:column id="col1"> <f:facet name="header"> <h utputLabel id="lblchange" value="Select" /> </f:facet> <h:selectBooleanCheckbox id="chkid" value="#{planGroup.chkValue}"> </h:selectBooleanCheckbox> <f:param name="id" value="#{result.planGroupId}" /> </h:column> Hope it works.
|
My Blog SCJP 5 SCWCD 5
|
 |
 |
|
|
subject: how to set the value of the primary key to the check box in data table
|
|
|