33 < meta charset ="UTF-8 ">
44 < title > Users</ title >
55</ head >
6+ <!--https://code.jquery.com/-->
7+ <!--http://stackoverflow.com/a/24070373/548473-->
8+ < script src ="https://code.jquery.com/jquery-3.2.1.min.js "
9+ integrity ="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4= "
10+ crossorigin ="anonymous " async >
11+ </ script >
612< body >
7- < table border ="1 " cellpadding ="8 " cellspacing ="0 ">
8- < thead >
9- < tr >
10- < th > #</ th >
11- < th > Full Name</ th >
12- < th > Email</ th >
13- < th > Flag</ th >
14- </ tr >
15- </ thead >
16- < tbody >
17- <!--/*@thymesVar id="users" type="java.util.List<ru.javaops.masterjava.persist.model.User>"*/-->
18- < tr th:each ="user,iter: ${users} ">
19- < td th:text ="${iter.count} "> </ td >
20- < td th:text ="${user.fullName} "> </ td >
21- < td th:utext ="${user.email} "> </ td >
22- < td th:text ="${user.flag} "> </ td >
23- </ tr >
24- </ tbody >
25- </ table >
13+ < section >
14+ < table border ="1 " cellpadding ="8 " cellspacing ="0 ">
15+ < thead >
16+ < tr >
17+ < th > #</ th >
18+ < th > Full Name</ th >
19+ < th > Email</ th >
20+ < th > Flag</ th >
21+ < th />
22+ </ tr >
23+ </ thead >
24+ < tbody >
25+ <!--/*@thymesVar id="users" type="java.util.List<ru.javaops.masterjava.persist.model.User>"*/-->
26+ < tr th:each ="user,iter: ${users} ">
27+ < td th:text ="${iter.count} "> </ td >
28+ < td th:text ="${user.fullName} "> </ td >
29+ < td th:utext ="${user.email} "> </ td >
30+ < td th:text ="${user.flag} "> </ td >
31+ < td > < input type ="checkbox " th:value ="|${user.fullName} <${user.email}>| "/> </ td >
32+ </ tr >
33+ </ tbody >
34+ </ table >
35+ < hr />
36+ < p >
37+ < input id ="subject " placeholder ="subject " size ="30 ">
38+ </ p >
39+ < p >
40+ < textarea id ="body " placeholder ="mail body " cols =75 rows =5 > </ textarea > < br />
41+ </ p >
42+ < p >
43+ < button type ="button " onclick ="send() "> Send</ button >
44+ </ p >
45+ < pre id ="result "> </ pre >
46+ </ section >
47+ < script type ="text/javascript ">
48+ function send ( ) {
49+ $ ( '#result' ) . html ( "Sending ..." ) ;
50+ var users = $ ( "input:checkbox:checked" ) . map ( function ( ) {
51+ return this . value ;
52+ } ) . get ( ) ;
53+ // https://stackoverflow.com/a/22213543/548473
54+ $ . post ( "send" , "users=" + users + "&subject=" + $ ( "#subject" ) . val ( ) + "&body=" + $ ( "#body" ) . val ( ) )
55+ . done ( function ( result ) {
56+ $ ( '#result' ) . html ( result ) ;
57+ } )
58+ . fail ( function ( result ) {
59+ $ ( '#result' ) . html ( result ) ;
60+ } ) ;
61+ }
62+ </ script >
2663</ body >
2764</ html >
0 commit comments