struts2 needs to change the class style through the values returned by the server.
try to modify it with js, but the page is a list of users, looped out, id what, can only modify one
<c:forEach items="${adminlist}" var="admin">
<tr>
<!-- -->
<td>${admin.username }</td>
<!-- -->
<td>${admin.name }</td>
<!-- class 10 ${admin.power} 0/1-->
<td><span class="switch-on" ></span></td>
<!-- -->
<td><a rel="1" name="see"></a> <a rel="1" name="delete"></a> </td>
<!-- -->
<td><span class="switch-off"></span></td>
</tr>
</c:forEach>
use other people"s switch style, the result is not very uncomfortable
this is what the switch author called the method
switchEvent method that turns on and off the execution of the action for element binding. You need to pass in three parameters, the first of which is an id, string type; the second anonymous function represents what the execution is on; and the third anonymous function represents the content that closes the execution.
for example:
switchEvent ("- sharpid", function () {on}, function () {off});
in a project, during initialization, needs to set the display status of the switch according to the status value returned by the server , you can directly change the class.. Or use honeySwitch.showOn ("- sharpid"), honeySwitch.showOff ("- sharpid") to control the switch display status.
I have tried to modify it with Angular myself, but the so-called examples on the Internet are difficult to understand.