小编Aru*_*hny的帖子

这个空检查有什么问题?

List<Foo> results = null;
results = this.getResults();
if (results == null || results.size() == 0)
{
    LOGGER.warn("results empty");
}
else
{
    LOGGER.warn("results:" + results.toString());
}
Run Code Online (Sandbox Code Playgroud)

getResults返回空List 时,上面的代码总是产生以下输出.

results:[null]
Run Code Online (Sandbox Code Playgroud)

我需要响应这个空方案,但不知道如何捕获它.

java null list

0
推荐指数
1
解决办法
404
查看次数

Java变量范围

当变量在本地范围和全局范围内初始化时,如何this在不使用同一类中的关键字的情况下使用全局范围?

java scope

0
推荐指数
1
解决办法
2062
查看次数

我的插入语句有什么问题?mysql java

我的插入方法有什么问题?我的表有两列,名称,艺术家和时间戳,实际上,我如何将时间戳参数传递给insert语句?

ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                /*FileWriter dir = new FileWriter(nameOfSong.getText()
                        + ".txt");
                BufferedWriter buffer = new BufferedWriter(dir);
                buffer.write(nameOfSong.getText());
                buffer.newLine();
                buffer.write(artist.getText());
                buffer.newLine();
                buffer.newLine();
                buffer.write(lyrics.getText());
                buffer.close();
                */

                Statement statement = connection.createStatement();
                statement.executeUpdate("INSERT INTO lyrics1_lyrics1 VALUES(" +
                nameOfSong.getText() + ", " + artist.getText() + "");


            } catch (Exception z) {
                System.err.println("Error: " + z.getMessage());
            } 
            internalFrame.dispose();
        }
    });
)
Run Code Online (Sandbox Code Playgroud)

java sql

0
推荐指数
1
解决办法
1148
查看次数

选中父 div 时检查单选按钮?

我有一个单选按钮,如果用户单击其内部的 div,我希望可以选择该按钮。我有一个 div 的点击事件,但我似乎无法检查单选按钮。

继承人我的代码:

var new_div = document.createElement('div');
        new_div.setAttribute('id', 'controlDiv');
        new_div.setAttribute('class', 'ansClass');
var newAnswer = document.createElement('input');
        newAnswer.setAttribute('type', 'radio');
        newAnswer.setAttribute('name', 'choice');
        newAnswer.setAttribute('class', 'radioButton');
        $(newAnswer).attr("id", "button"+j);


        var newLabel = $("<label>", {id: "label"+j, class: "ansLabel", text: "answer"+j});


        $(new_div).append(newAnswer); 
        $(new_div).append(newLabel);



$( "#controlDiv" ).click(function() {
    var radButton = $(this).find('input[type=radio]');
    radButton.click();
      //  $(radButton).attr("checked", "checked");
});
Run Code Online (Sandbox Code Playgroud)

html jquery

0
推荐指数
1
解决办法
3573
查看次数

Jquery ajax与json解析问题

$(document).ready(function () {
    $.ajax({
        type: 'POST',
        url: 'http:abc/public/aditya/eJewelry/get_store_details.php?store_id=udb1001',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
            alert(data);
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

我正在向该网址发送请求并获得回复: -

[{
    "id": "22",
    "storename": "Unique Diamond Boutique",
    "email": "croberts@uniquediamondboutique.com",
    "storeimage_ipad": "",
    "website": "www.uniquediamondboutique.com",
    "store_code": "udb1001",
    "street_address": "157 E New England Avenue\nSuite 202\n",
    "country": "US",
    "zipcode": "32789",
    "state": "FL",
    "city": "Winter Park",
    "email_sales": "croberts@parkavegold.com",
    "personal_phone": "407-312-6768",
    "company_phone": "407-218-5958",
    "image": "store_22.png",
    "status": "1",
    "paypal_email": "croberts@uniquediamondboutique.com",
    "moreAddress": [{
        "street_address": "123 main st",
        "city": "MIAMI",
        "state": "FL",
        "zipcode": "33106",
        "country": "", …
Run Code Online (Sandbox Code Playgroud)

ajax jquery json

0
推荐指数
1
解决办法
69
查看次数

允许整数和空格的Jquery规则验证

我当前接受整数的验证器是

$( "#UserForm" ).validate({
  rules: {
    contact: {
      required: true,
      number: true,
      minlength: 6,
    }
  }
});
Run Code Online (Sandbox Code Playgroud)

它工作正常

但现在我想改变它以便也接受空间.

我的代码应该是什么?请帮助我在jquery中初学者

jquery jquery-validate

0
推荐指数
1
解决办法
2719
查看次数

如何阻止IE显示网站?

我们都知道IE在打开html和渲染css文件方面有很多问题.

我希望IE在打开页面时不显示任何内容.

我怎样才能做到这一点?

html javascript css

-2
推荐指数
1
解决办法
169
查看次数

标签 统计

java ×3

jquery ×3

html ×2

ajax ×1

css ×1

javascript ×1

jquery-validate ×1

json ×1

list ×1

null ×1

scope ×1

sql ×1