I work in JAVAEE project with Struts2 and i am using jquery DataTable i want to add a link with each row who call an action with id.
This is the html code:
<div class="table-responsive">
<div id="dataTables-example_wrapper"
class="dataTables_wrapper form-inline" role="grid">
<table
class="table table-striped table-bordered table-hover dataTable no-footer"
id="matable"
aria-describedby="dataTables-example_info">
<thead>
<tr>
<th>Libellé planing</th>
<th>Nom de la classe</th>
<th>Actions</th>
</tr>
</thead>
</table>
</div>
</div>
And this how i push data from with AJAX:
$(document).ready(
function() {
// recuperation des ressources
$.ajax({
url : "listPlaning",
type : 'GET',
dataType : 'json',
contentType : 'application/json',
mimeType : 'application/json',
success : function(msg) {
for ( var i in msg) {
$("#matable").dataTable()
.fnAddData(
[
msg[i].libellePlanning,
msg[i].classe,
//this code doesn't work "<s:url var='test' action='action'><s:param name='id'>"+msg[i].idPlaning+"</s:param></s:url>"
]);
}
},
error : function(error) {
},
complete : function(x) {
}
});
});
I don't know how to call action with <a href="">
and i tried to put struts2 tags itdoesn't work. Can some one help me please
您可以尝试相对网址
'test.action?id='+msg[i].idPlaning
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.