Jquery 播放框架服务器端处理请求为空

Jquery 播放框架服务器端处理请求为空,jquery,playframework,datatables,Jquery,Playframework,Datatables,我得到了一个包含很多行条目的数据表,我想把它放在服务器端。问题是我无法获取sEcho,因为request()对我来说总是null。我的代码如下: $.fn.loadTable = function (url,options) { // check if the options exists or not, defaults to false var activity = ((typeof options === "undefined") || (typeof optio

我得到了一个包含很多行条目的数据表,我想把它放在服务器端。问题是我无法获取
sEcho
,因为
request()
对我来说总是
null
。我的代码如下:

    $.fn.loadTable = function (url,options) {

    // check if the options exists or not, defaults to false
    var activity = ((typeof options === "undefined") || (typeof options.activity === "undefined")) ? false : options.activity;
    var document = ((typeof options === "undefined") || (typeof options.document === "undefined")) ? false : options.document;
    var idable   = ((typeof options === "undefined") || (typeof options.idable === "undefined")) ? false : options.idable;

    var element = this;

    var table = element.find("table").dataTable({
            "bProcessing": true,
            "bServerSide": true,
            "bPaginate": false,
        "bLengthChange": false,
        "bFilter": true,
        "bSort": true,
        "bInfo": false,
        "bAutoWidth": false,
        "oLanguage": {
            "sZeroRecords": "No data available"
        }
    });     

    $.ajax({
        'url':url,
        dataType:"json",
        type:'GET',
        success: function(data) {                       
            $.each(data,function(index,item) {....
我的控制器如下所示:

    public static Result getActivitiesByParticipant() throws UnsupportedEncodingException {
    List<Container> activities = CMISConnection.listActivitiesByParticipant(session("user"));   
            // TODO: change to server side
            // manipulate jsonresult
            ObjectNode result = Json.newObject();
            Map<String, String[]> params = request().queryString();
            result.put("sEcho", Integer.valueOf(params.get("sEcho")[0]));
            result.put("iTotalRecords", activities.size());
            result.put("iTotalDisplayRecords", activities.size());

            ArrayNode an = result.putArray("aaData");

            for(Container c : activities) {
              ObjectNode row = Json.newObject();
              row.put("0", c.getName());
              row.put("1", c.getCreator());
              row.put("2", dateFormat.format(c.getCreationDate()));
              row.put("3", c.getOptischerBetreff());
              an.add(row);
            }
    return ok(result);
}

参数可能为空,因为url不包含查询字符串。url看起来像什么


这是一个全面的play 2.0+datatables示例,以防万一,您以前从未遇到过它。

我只是打电话给/activity/participant,这是我的URL。我尝试构建这个示例。也许这是显而易见的,但为了使sEcho和其他参数在服务器端可用,它们需要包含在url
?sEcho=…&…
中,以标准datatables方式初始化表可以为您解决这一问题<代码>$('#示例').dataTable({“bProcessing”:true,“bserver端”:true,“sAjaxSource”:“scripts/id.php”})î如果url是scripts/id.php,那么如何在其中包含sEcho?据我所知,sEcho会自动添加到url中,而不必添加
GET     /activity/participant                           controllers.Content.getActivitiesByParticipant()