我有一个GET方法,通过点击jsp
页面中的链接进行实例化
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 + "'>" " + bucketList[i] + "</a></div>";
$("#dispdir").append(markup);
$("#" + bid).on("click",fetchDirectory());
bucketId++;
}
$("#dispdir").append("<div>");
}
现在,当点击链接时,它将调用服务器,服务器将返回对象${S3DirectoryList}
。如何检查对象是否返回。
这将是什么语法?
答案 0 :(得分: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>