Hello,

Here is my entity model:


  | Module
  |  |-- name
  | Permission
  |  |-- Module
  |  |-- name
  | Role
  |  |-- Permissions
  |  |-- name
  | 

When I want to provide a front-end to edit Role information I do something like 
this and everything works:


  | <h:form>
  |     <h:inputText value="#{role.name}"/>
  | 
  |     <h:selectManyCheckbox value="#{role.permissions}">
  |         <s:selectItems value="#{permissions}" var="p" label="#{p.name}"/>
  |         <s:convertEntity/>
  |     </h:selectManyCheckbox>
  | 
  |     <h:commandLink action="#{roleHome.persist}" value="Save"/>
  | </h:form>
  | 

The problem here is that all check boxes for permissions are grouped together. 
If you look at the entity model you will see that each permission belongs to a 
module. So I wanted to show check boxes grouped by module name.  I tried 
something like this but it didn't work:


  | <h:form>
  |     <h:inputText value="#{role.name}"/>
  | 
  |     <h:dataTable value="#{modules.resultList}" var="m">
  |         <h:column>
  |             #{m.name}
  | 
  |             <h:selectManyCheckbox value="#{role.permissions}">
  |                 <s:selectItems value="#{m.permissions}" var="p" 
label="#{p.name}"/>
  |                 <s:convertEntity/>
  |             </h:selectManyCheckbox>
  |         </h:column>
  |     </h:dataTable>
  | 
  |     <h:commandLink action="#{roleHome.persist}" value="Save"/>
  | </h:form>
  | 

The page looks exactly as I wanted it to. It's just the state of check boxes 
doesn't get persisted. I guess it's because "name" element of HTML check box 
also gets a portion of it from h:dataTable.

Any suggestions?

Thank you,
Yuriy



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4096232#4096232

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4096232
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to