小编use*_*587的帖子

修剪字符串删除超过需要

下面的代码用于修剪我的字符串.不幸的是,它删除的不仅仅是'conf'值.

我这样做了吗?

这样做是添加一个双html响应地址,所以我删除了第一个网址'conf'

String pageIdUrl = response.getRedirectUrl();

if(pageIdUrl.startsWith(conf.toString()));
{
    pageIdUrl = pageIdUrl.substring(conf.toString().length());
}
Run Code Online (Sandbox Code Playgroud)

java

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

Java枚举构造函数错误

我正在尝试创建一个enum类,以便我可以在for循环中使用每个值,每次获取一个值.

这是我的enum声明:

public enum SpaceStyle {

    public SpaceStyle(spaceStyle1, spaceStyle2, spaceStyle3);
    private String key;

    SpaceStyle(String key) {
        this.key = key;
    }

    public String getKey() {
        return key;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是for我想循环并使用每个方法的循环.

for (SpaceStyle key : SpaceStyle.values()) {
    Map<String, String> contentMap = createContentMap(conf, versionNumber, data);
    createAndPopulateSpace(conf, versionNumber, contentMap, key.toString());
}

// The final method where the key of the enum will be used.
public StudioResponse createSpace(ProductInstance conf, VersionNumber \
            versionNumber, String spaceName, String spaceKey, String key) { …
Run Code Online (Sandbox Code Playgroud)

java

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

没有方法'替换'jquery错误

我得到了以下js代码,它在控制台中出错,我不太确定我做错了什么.基本上我正在尝试获取字段列表,以便我可以进行一些计算.

var LabourItems = {
    rate: null,
    hours: null,
    total: null,
    init: function(object) {
        var rate = $(object).children('.rate').first();
        var hours =$(object).children('.hours').first();
        total = rate * hours;
        updateTotal(object,total);
    },
    updateTotal: function(object,  total) {
        $(object).children('.total').first().attr('value', total)
    }
}

//reactTochange for those inputs that you want to observe
$('.hours').live(function() {
    var labourItems;

    jQuery.each($('.labouritems'), function(key,value){
        labourItems.push(LabourItems.init(value));
    });

});
Run Code Online (Sandbox Code Playgroud)

控制台错误:

Uncaught TypeError: Object function () {
    var labourItems;

   jQuery.each($('.labouritems'), function(key,value){
       labourItems.push(LabourItems.init(value));
   });

} has no method 'replace'
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

未定义的javascript函数

我有以下代码:

var LabourItems = {
   rate: null,
   hours: null,
   total: null,
   init: function(object) {
      var rate = $(object).children('.rate').first();
      var hours =$(object).children('.hours').first();
      total = rate * hours;
      updateTotal(object,total);
   },
   updateTotal: function(object,  total) {
      $(object).children('.total').first().attr('value', total)
   }
}

//reactTochange for those inputs that you want to observe
$('.hours').live("click", function() {
   jQuery.each($('.labouritems'), function(key,value){
      LabourItems.init(value);
   });
});
Run Code Online (Sandbox Code Playgroud)

并确定未定义的函数错误:

updateTotal(object,total)未定义

你能不能让我知道我做错了什么.

javascript jquery

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

标签 统计

java ×2

javascript ×2

jquery ×2