Note: Funs is a list<function> from the action where the property has its sub-object list<role> traversed by the s tag, or through the C tag.
In the JSP page:
<s:iterator value= "funs" var= "Fun" >
<tr>
<td><!--A list of parent permissions--
<input type= "checkbox" Name= "Checkfuns"id= "Parent_${fun.fid}"Value= "${fun.fid}"/>${fun.fname}
</td>
<td><!--a list of the corresponding child permissions--
<s:iterator value= "#fun. Childfuns" var= "Childfun" >
<input type= "checkbox" Name= "Checkfuns"id= "Child_${fun.fid}_${childfun.fid}"Value= "${childfun.fid}"/>${childfun.fname}
</s:iterator>
</td>
</tr>
</s:iterator>
jquery in the wording:
$ (function () {
Select the parent permission, and the child permissions are selected
$ ("input[id^= ' Parent_ ']"). Click (function () {// red ^ represents start from Parent_
var id = $ (this). Val ();
$ ("input[id^= ' Child_" +id+ "_ ']"). Prop (' checked ',$ (this). Prop (' checked '));
});
If the number of child permissions is the same as the number of child permissions, the parent permission is also selected
});
Use jquery to get a background pass value to select all