小编Ale*_*lex的帖子

如何使wsimport生成构造函数?

wsimport生成没有参数化构造函数的源代码.因此,如果bean具有许多属性,则需要手动调用所有setter:

Person person = new Person();
person.setName("Alex");

Address address = new Address();
address.setCity("Rome");

person.setAddress(address);
Run Code Online (Sandbox Code Playgroud)

只需编写如下代码,它就更具可读性和便捷性:

Person person = new Person("Alex", new Address("Rome"))
Run Code Online (Sandbox Code Playgroud)

那么,有没有办法wsimport做这个工作?(我正在使用maven wsimport插件)

java web-services wsimport maven

9
推荐指数
2
解决办法
4974
查看次数

window.onload在Firefox + Greasemonkey脚本中有效但在Chrome用户脚本中无效吗?

有一个页面http://example.com/1.php像往常一样包含javascript文件:

<script type="text/javascript" src="/util.js?1354729400"></script>
Run Code Online (Sandbox Code Playgroud)

这个文件包含名为exampleFunction的函数,我需要在我的用户脚本中使用它.我还有一个用户脚本:

// ==UserScript==
// @name          SomeName
// @namespace     http://example.com/userscripts
// @description   Greets the world
// @include       http://example.com/*
// ==/UserScript==
window.onload = function () {
        console.log(exampleFunction);
      alert("LOADED!");
}
Run Code Online (Sandbox Code Playgroud)

在Firefox中完美运行并在Chrome中返回错误:

Uncaught ReferenceError: exampleFunction is not defined 
Run Code Online (Sandbox Code Playgroud)

我如何使其工作?

javascript greasemonkey google-chrome cross-browser userscripts

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

如何访问Angular表单元素的属性

假设我们有某种形式

<form name="myForm" data-ng-controller="Ctrl">
    <input name="input" data-ng-model="userType" data-description="User Type" required>
</form>
Run Code Online (Sandbox Code Playgroud)

在控制器中,我们可以通过代码访问该输入元素

$scope.myForm.userType
Run Code Online (Sandbox Code Playgroud)

但是我们如何获得这个元素的data-*属性呢?

html javascript angularjs

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

如何将源文件夹添加到grails应用程序

我使用STS开发Grails应用程序,我需要在那里使用wsimport实用程序生成的一堆类.为了不将我的源与自动生成的源混合,我想添加单独的目录并将生成的类放在那里,如下所示:

grails-project  
 |  
 |-- .classpath  
 |-- .groovy  
 |-- .project  
 |-- .settings  
 |-- application.properties  
 |-- grails-app  
 |-- lib  
 |-- scripts  
 |-- src
 |   |-- groovy
 |   |-- java
 |   `-- wsimport     <- where I want to make additional source folder
 |-- target  
 |-- target-eclipse  
 |-- test  
 `-- web-app
Run Code Online (Sandbox Code Playgroud)

我可以在.classpath文件中添加新的类路径条目,STS会识别源代码,但我该如何处理Grails?我是否需要在某个配置文件中指定它?

grails sts-springsourcetoolsuite

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