I have jsp page, which recive in model a set like this: ['a', 'c']. Set can be bigger.
We have some checkboxes for example:
<input name="a" type="checkbox">
<input name="b" type="checkbox">
<input name="c" type="checkbox">
...
If in the set the values correspondings to the <input>
attribute name - we need put attribute "checked" to this <input>
.
I have a solution using jQuery:
var arr = '${resource}'.replace('[', '').replace(']', '').replace(' ', '').split(','); // make array from string
for (var i = 0; i< arr.length; i++){
$('input[name='+arr[i]+']').prop('checked',true);
}
But (if it will be more simpler solution) how it can be done with JSTL tags?