JSF Datatable and SelectBooleanCheckBox -
i have scenario have give option user select applications , related profiles. user should select @ least 1 application , 1 profile , can select more one. each application has own profiles , there can multiple applications. userbean has list of applicationvo , applicationvo has isselected (boolean), application id (int), application name(string) , profile list. profile list has list of profilevo , profilevo has isselected(boolean), profile id(int) , profile name(string).
i new jsf , tried use datatable , selectbooleancheckbox works fine. @ point not sure how validate , display error message in same jsp remaining user entered data intact. not sure how update bean options checked/unchecked user.
when user clicks submit validations should be:
- at least 1 application should selected
- if application selected, @ least 1 profile should selected
- profile check boxes should disabled until application selected
- when user unchecks application check box, profiles check box should disabled.
i have following code. please me , can suggest me if there other best way accomplish same.
<h:datatable value="#{userbean.applicationlist}" var="applist"> <h:column> <f:facet name="header"> <h:outputtext value="applications" /> </f:facet> <h:selectbooleancheckbox value="#{applist.isselected}" label="#{applist.applicationname}"/> <h:outputtext value="#{applist.applicationname}" /> </h:column> <h:column> <f:facet name="header" > <h:outputtext value="profiles" /> </f:facet> <h:datatable value="#{applist.profilelist}" var="profilelist"> <h:column> <h:selectbooleancheckbox value="#{profilelist.isselected}" /> <h:outputtext value="#{profilelist.profilename}" /> </h:column> </h:datatable> </h:column> </h:datatable>
i able implement validating in bean , able selected values applicationlist
Comments
Post a Comment