0

我有一个通过单击jsp页面中的链接来实例化的 GET 方法

HTML:

<div class="panel accordion clearfix" id="dispdir">
    <script type="text/javascript">
        window.onload = function() {
            //showDirectorySegment(${S3DirectoryList},"folder",null);
            showBucketList(${S3BucketList});
        };
    </script>
</div>

Javascript:

function showBucketList( bucketList ) {

    markup = "<div class=\"clearfix\">";
    $("#dispdir").append(markup);
    for ( var i = 0; i < bucketList.length; i++ ) {
         var bid = "bucket_"+bucketId;
         var key = bucketList[i].replace(/ /g,"+");
         var uri = "/accountingReports?bucketName=" + key;
         var res = encodeURI(uri);
         markup = "<div class=\"well clearfix\" style=\"background-color:#A5FFED;font-size:15px\">";
         markup += "<a href='" + res + "' style=\"text-decoration:none\" id='" + pid + "'>"&nbsp;&nbsp;" + bucketList[i] + "</a></div>";
         $("#dispdir").append(markup);   
         $("#" + bid).on("click",fetchDirectory());
         bucketId++;
    }
    $("#dispdir").append("<div>");
}

现在,当单击链接时,它将调用服务器,服务器将返回 object ${S3DirectoryList}。现在如何检查对象是否返回。

那将是什么语法?

4

1 回答 1

0

您需要在 JSP 文件中编写此脚本:

<script type="text/javascript">
        window.onload = function() {
            var object = '${S3BucketList}'; //This variable will contain value returned by server    
            //check this object for null
            //showDirectorySegment(${S3DirectoryList},"folder",null);
            showBucketList(${S3BucketList});
        };
</script>
于 2014-06-27T09:18:49.420 回答