小编Ali*_*abi的帖子

angularjs数据表按钮插件

我正在使用angularjs datatable并尝试在此页面中使用按钮插件https://l-lin.github.io/angular-datatables/#/withButtons

.withButtons([
    'columnsToggle',
    'colvis',
    'copy',
    'pdf',
    'excel',
    {
        text: 'Some button',
        key: '1',
        action: function (e, dt, node, config) {
            alert('Button activated');
        }
    }
]);
Run Code Online (Sandbox Code Playgroud)

我得到Unknown按钮类型:'columnsToggle'和'colvis',但当我从代码中删除'columnsToggle'和'colvis'时它运行没有任何问题,但除了自定义按钮外不显示其他按钮

{
    text: 'Some button',
    key: '1',
    action: function (e, dt, node, config) {
        alert('Button activated');
    }
}
Run Code Online (Sandbox Code Playgroud)

复制,pdf,excel没有出现,任何人都可以帮我解决问题吗?

javascript jquery datatables angularjs

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

如何获取亚马逊s3服务的对象密钥

我正在尝试使用 Java ( http://docs.aws.amazon.com/AmazonS3/latest/dev/RetreeringObjectUsingJava.html )获取存储在 Amazon S3 中的文件,但我对对象键有问题,因为我不这样做不知道那是什么。

存储桶名称是testbucket,我在该存储桶中有一个具有该名称的文件夹files。如果我有一个名为image.jpeg;的文件 对象键是什么?

private static String bucketName = "testbucket"; 
private static String key="files/image.jpeg";      


public static void main(String[] args) throws IOException {
    AmazonS3 s3Client = new AmazonS3Client(new ProfileCredentialsProvider());
    S3Object s3object = s3Client.getObject(new GetObjectRequest(
                bucketName, key));
     } 
Run Code Online (Sandbox Code Playgroud)

我得到这个输出:

  21:43:54.054 [main] DEBUG com.amazonaws.request - Sending Request: GET https://adap-demo.s3.amazonaws.com /report_templates/Testreport_1.jrxml
Headers: (User-Agent: aws-sdk-java/1.10.30 Linux/4.4.0-70-generic
OpenJDK_64-Bit_Server_VM/25.121-b13/1.8.0_121, Content-Type:
application/x-www-form-urlencoded; charset=utf-8, ) 
21:43:54.164 [main] DEBUG c.a.services.s3.internal.S3Signer - Calculated
string to sign:
"GET
application/x-www-form-urlencoded; charset=utf-8 …
Run Code Online (Sandbox Code Playgroud)

java amazon-s3

6
推荐指数
1
解决办法
2万
查看次数

提交表单前执行Javascript函数

我有以下执行后端控制器和 JavaScript 函数的 spring 表单,一切正常,但我需要在提交表单之前执行 JavaScript 函数。怎么做?

以下代码在执行 JavaScript 之前提交表单。

<form:form modelAttribute="api" id="form">
                <form:textarea path="text" class="form-control" rows="10" id="redacttext"/>
                <button type="submit" class="btn btn-default">Submit</button>
 </form:form>
Run Code Online (Sandbox Code Playgroud)

Javascript 函数

function dosomething() {
 //do something 
}
Run Code Online (Sandbox Code Playgroud)

通过 jquery 执行 javascript 函数

$('#form').submit(function() {
      dosomething();
  });
Run Code Online (Sandbox Code Playgroud)

javascript forms jquery spring-mvc

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

Apache Shiro:登录时出现IllegalArgumentException

使用Apache Shiro时,登录时会出现以下异常:

java.lang.IllegalArgumentException:配置错误.配置错误.具有属性[loginUrl]的指定对象[authc],而不首先定义该对象的类.请先指定类属性,例如myObject = fully_qualified_class_name,然后定义其他属性.

shiro.ini

  # ----------------------------------------------------------------------------- 
  [main]
  authc.loginUrl=/login.xhtml
  authc.successUrl=/hello.xhtml
  logout.redirectUrl=/hello.xhtml

  # Users and their (optional) assigned roles
  # username = password, role1, role2, ..., roleN
  # -----------------------------------------------------------------------------
  [users]
  root = secret, admin
  guest = guest, guest

  # -----------------------------------------------------------------------------
  # Roles with assigned permissions
  # roleName = perm1, perm2, ..., permN
   -----------------------------------------------------------------------------
 [roles]
 admin = *
 schwartz = lightsaber:*
 goodguy = winnebago:drive:eagle5

  #------------------------------------------------------------------------------
 [urls]
 /hello.xhtml= authc 
Run Code Online (Sandbox Code Playgroud)

调节器

public void login() {
    Factory<SecurityManager> factory = new IniSecurityManagerFactory();
    SecurityManager securityManager = …
Run Code Online (Sandbox Code Playgroud)

java security jsf shiro

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

Angularjs Datatable服务器端分页

我正在尝试在此链接中进行Angularjs Datatable服务器端分页https://l-lin.github.io/angular-datatables/#/serverSideProcessing

所以我使用这段代码

    $scope.dtOptions = DTOptionsBuilder.newOptions()
       .withOption('ajax', {
                  dataSrc: function(json) {
                    conole.log(json)
                    json['recordsTotal'] =json.length
                    json['recordsFiltered'] = json.length
                    json['draw']=1
                    conole.log(json)
                    return json;
                  },
              url: 'api/footestrecords',
              type: 'GET'
           })
       .withOption('processing', true)
       .withOption('serverSide', true)
       .withPaginationType('full_numbers');
Run Code Online (Sandbox Code Playgroud)

我在dataSrc参数中手动添加了recordsTotal,recordsFiltered和row

这是添加recordsTotal,recordsFiltered和row之前和之后的json数据

添加之前的json数据

[Object, Object, Object, Object, Object, Object, Object, Object,
Object,Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object]
Run Code Online (Sandbox Code Playgroud)

添加后的json数据

 [Object, Object, Object, Object, Object, Object, Object, Object,
  Object, Object, Object, Object, Object, Object, Object, Object, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery datatables angularjs angular-datatables

5
推荐指数
1
解决办法
2万
查看次数

将ZonedDateTime类型转换为Gson

我有返回对象的arraylist的rest服务,并且我已经实现了jersy restful客户端来执行它,但是我在将ZonedDateTime类型转换为json时遇到了问题,因此出现此错误

 Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 231 path $[0].lastmodifieddate
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

实体中的lastmodifieddate列

 @Column(name = "lastmodifieddate")
 private ZonedDateTime lastmodifieddate;

 //getter and setter
Run Code Online (Sandbox Code Playgroud)

休息服务

@RequestMapping(value = "/getScoreFactor",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public List<Scorefactor> getScoreFactor() throws JSONException {
    return scoreService.getScoreFactor();
}   
Run Code Online (Sandbox Code Playgroud)

烦躁的客户

  try {

        Client client = Client.create();
        WebResource webResource = client
           .resource("http://localhost:8080/adap/api/getScoreFactor");
        ClientResponse response = webResource.accept("application/json")
                   .get(ClientResponse.class);

        String output =  response.getEntity(String.class);

        System.out.println("output--"+output);
        Type listType =  new TypeToken<List<Scorefactor>>() {}.getType();

        List<Scorefactor> scorefactors = new …
Run Code Online (Sandbox Code Playgroud)

java rest json jersey gson

5
推荐指数
3
解决办法
4666
查看次数

无法绑定到“ dtOptions”,因为它不是“表”的已知属性。

我正在努力获取角度方法并使用此代码https://l-lin.github.io/angular-datatables/#/basic/angular-way

- node version:v6.10.3
- npm version:v6.10.3
- angular version:4.3.2
- jquery version:3.2.1
- datatables version:1.10.15
- angular-datatables version:4.2.0
- angular-cli version:1.2.6
Run Code Online (Sandbox Code Playgroud)

我已执行此步骤来修复模块“ AppModule”导入的意外值“ DataTablesModule”。请添加一个@NgModule注释。

 1-in tsconfig.json add
"baseUrl": ".",
"paths": {
   "@angular/*": [
    "node_modules/@angular/*"
 ]
 2-in webpack.comon.js add 
  plugins: [
         new TsConfigPathsPlugin({
          configFileName: helpers.root('tsconfig.json'),
          compiler: "typescript",
        })
   ]  
Run Code Online (Sandbox Code Playgroud)

但是得到这个错误

Can't bind to 'dtOptions' since it isn't a known property of 'table'. 
Run Code Online (Sandbox Code Playgroud)

谁能帮我解决这个问题?

datatable angularjs angular-datatables

5
推荐指数
3
解决办法
7201
查看次数

检查javascript数组对象属性

我有以下javascript对象数组,如果至少有一个对象为true,我需要检查输出属性返回true否则返回false,有人可以帮我实现吗?

var array=[{"id":100,"output":false},{"id":100,"output":false},
{"id":100,"output":true}]    
Run Code Online (Sandbox Code Playgroud)

javascript arrays arraylist

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

检查arraylist属性是否适用于所有对象

我有以下Javascript对象数组,如果对所有对象都为true,我需要检查输出属性,如果对所有对象输出true则返回true否则返回false,任何人都可以帮我实现吗?

 var array=[{"id":100,"output":true},{"id":200,"output":true}]
Run Code Online (Sandbox Code Playgroud)

更新

我已经尝试了这个代码但是如果只有一个输出为真而不是所有输出它会执行打印

function check(){
     var data=[{"id":100,"output":false},{"id":200,"output":true}]
     data.every(function (e) {
         if(e.checked===true){
             console.log("print something")
        }
       });
 } 
Run Code Online (Sandbox Code Playgroud)

代码有什么问题?

javascript arrays arraylist

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