标签: bind

带复选框的 Spring MVC Thymeleaf 绑定列表

我正在尝试使用 thymeleaf 创建一个包含一系列复选框的表单。我传递给 thymeleaf 模板的对象源包含一个字符串和一个列表。

package com.controller;

import java.util.List;

public class Source {
private String sourceName;
private List<String> testList;

public String getSourceName()
{
    return sourceName;
}

public void setSourceName(String name)
{
    this.sourceName = name;
}

public List<String> getTestList()
{
    return testList;
}

public void setTestList(List<String> list)
{
    this.testList = list;
}

}
Run Code Online (Sandbox Code Playgroud)

我使用此 MVC 控制器将源类型的对象传递到模板中。

package com.controller;


import java.io.IOException;
import java.util.List;
import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.View;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;

import …
Run Code Online (Sandbox Code Playgroud)

checkbox spring bind thymeleaf

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

客户端中的 DatagramSocket 未绑定到服务器中的端口。端口已被使用

我有一个服务器正在等待客户端通过 DatagramSocket 发送数据包。但是当在客户端中我使用与服务器相同的端口时(以便它们可以通信)我在客户端得到一个异常:

Exception in thread "main" java.net.BindException: Address already in use: Cannot bind
at java.net.DualStackPlainDatagramSocketImpl.socketBind(Native Method)
at java.net.DualStackPlainDatagramSocketImpl.bind0(DualStackPlainDatagramSocketImpl.java:80)
at java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:93)
at java.net.DatagramSocket.bind(DatagramSocket.java:372)
at java.net.DatagramSocket.<init>(DatagramSocket.java:222)
at java.net.DatagramSocket.<init>(DatagramSocket.java:279)
at tp.Repositorio.main(Cliente.java:146)
Run Code Online (Sandbox Code Playgroud)

所以在服务器端,我有一个线程正在处理数据包。像这样的东西:

addr = InetAddress.getByName("localhost");
DatagramSocket socket = new DatagramSocket(5008, addr);
DatagramPacket packet = new DatagramPacket(buff, buff.length);
 while(true)
    {
      s.receive(packet);
// and then it throws another thread to treat the packet...
    }
Run Code Online (Sandbox Code Playgroud)

在客户端,我有这样的事情:

 InetAddress inet;
 inet = InetAddress.getByName("localhost");
 s_data = new DatagramSocket(5008, inet);
Run Code Online (Sandbox Code Playgroud)

我试图更改双方的端口,但它也给了我这个例外。如果我将端口更改为例如服务器中的 5003 和客户端中的 5004,它不会给我任何异常(当然)但它们无法相互连接。

你们有什么想法可以解决这个问题吗?

谢谢。

编辑:

这是以下客户端代码(称为 repositorio): …

java sockets networking network-programming bind

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

Python Tkinter 可点击文本?

我想知道是否有办法在 Tkinter 中制作可点击的文本。也许就像您在游戏的标题屏幕上看到的那样,将鼠标悬停在文本上,它会自行更改颜色/突出显示。我需要点击执行另一个函数。

这些事情有可能吗?谢谢!

text bind tkinter colors click

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

绑定商店中更改的公式

我有公式,并希望执行它时,店这viewModelchangeData

当我这样做时,当存储中的数据发生变化时,公式不起作用

stores: {

    currentStore: {
        extend: 'Ext.store.MyStore',
        trackRemoved: false
    },
    },
    formulas: {

    'executeWhenStoreChange': {
        bind: '{currentStore}',

        get: function () {
           console.log('store change')
    },
Run Code Online (Sandbox Code Playgroud)

bind extjs store formula mvvm

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

Angular - 无法绑定到“属性”,因为它不是“a”的已知属性

我有我的两个对象

{
  "twitter": {
    "username": "potus",
    "postslimit": 10
  },
  "enum": [],
  "publicationdate": "2018-08-27T15:05:55.410Z",
  "_id": "5b8414ec3412b43a34f050cf",
  "clicks": [],
  "active": true,
  "user": " __ ",
  "type": "twitter",
  "__v": 0
}
Run Code Online (Sandbox Code Playgroud)

如果我显示:

<a 
  class="twitter-timeline" 
  data-tweet-limit="2" 
  href="https://twitter.com/{{tw.twitter.username}}">
</a>
Run Code Online (Sandbox Code Playgroud)

一切正常,但是当我尝试data-tweet-limit像这样绑定时:

<a 
  class="twitter-timeline" 
  data-tweet-limit="{{tw.twitter.postslimit}}"
  href="https://twitter.com/{{tw.twitter.username}}">
</a>
Run Code Online (Sandbox Code Playgroud)

我得到:

无法绑定到 'tweet-limit',因为它不是 'a' 的已知属性。("'"> ]data-tweet-limit="{{tw.twitter.postslimit}}" href="https://twitter.com/{{tw.twitter.username}}">

(我正在像这个线程一样加载 twitter 时间线

twitter bind angular

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

使用getaddrinfo和bind发送具有固定源端口号的UDP数据包

使用BJ的talker.c代码作为模板: http://beej.us/guide/bgnet/examples/talker.c

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

#define SERVERPORT "4950"    // the port users will be connecting to

int main(int argc, char *argv[])
{
    int sockfd;
    struct addrinfo hints, *servinfo, *p;
    int rv;
    int numbytes;
    struct sockaddr_storage their_addr;
    socklen_t addr_len;
    addr_len = sizeof their_addr;

    if (argc != 3) {
        fprintf(stderr,"usage: talker hostname message\n");
        exit(1);
    }

    memset(&hints, 0, sizeof hints);
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_DGRAM; …
Run Code Online (Sandbox Code Playgroud)

c sockets udp bind getaddrinfo

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

OCaml - 为什么要么不是 Monad

我是 OCaml 的新手,但曾使用过 Rust、Haskell 等,并且当我尝试bind在 上实现时感到非常惊讶Either,而且似乎没有任何通用实现已bind实现。

bind是我达到的第一个功能...甚至之前match,并且实现似乎很简单:

let bind_either (m: ('e, 'a) Either.t) (f: 'a -> ('e, 'b) Either.t): ('e, 'b) Either.t =
  match m with
  | Right r -> f r
  | Left l -> Left l
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?

monads ocaml bind

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

Svelte 每个工作两次/每个绑定错误(无法设置未定义的属性)

我正在尝试将元素绑定在{#each}块中并通过单击删除它们。

    <script>
        const foodList = [
          { icon: '', elem: null, },
          { icon: '', elem: null, },
          { icon: '', elem: null, },
        ]; 
        const remove = (index) => { 
          foodList.splice(index, 1);
          foodList = foodList;
        };
    </script>

    {#each foodList as {icon, elem}, index}
      <div 
        bind:this={elems[index]}
        on:click={remove}
      >
        {icon}
      </div>
    {/each}

Run Code Online (Sandbox Code Playgroud)

在我的代码中我遇到了两个问题:

  • {#each}迭代次数比他应该做的多两倍
  • 通过单击绑定元素删除数组中的项目后 - svelte 引发错误“无法设置未定义的属性”

为什么它会这样工作?

each binding bind svelte

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

如何将jboss.bind.address.management和jboss.bind.address.unsecure设置为与jboss.bind.address相同的值?

JBoss 7.1.1.Final问题:

是否有任何方法可以将jboss.bind.address.management和jboss.bind.address.unsecure设置为与jboss.bind.address相同的值,而无需在standalone.xml中对其进行硬编码或将它们作为命令行参数传递?

jboss bind ip-address

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

STL <list>正确生成和删除项目

  1. 我想知道,如果使用这个概念正确删除使用"new"生成的对象.
  2. 我没有使用"bind"而不是"bind2nd".我该怎么做呢?
  3. 最后一个问题:我如何使用lambda术语而不是命名函数?

为什么我使用列表?我决定采用列表而不是向量,因为我的对象没有排序.在最后,我想给面向对象带来一些"瀑布式"代码,主要是因为性能问题(你会在这里看到问题),所以我需要一个概念,我可以快速访问容器层次结构中的对象让他们彼此沟通,这也很快.也许想到模块化合成器.

class Layer {
    private:
    string name;
    bool active;
    public:
    Layer();
    Layer(string m_name, bool m_active);
    bool isName(string m_name);
};

// ... constructors

bool Layer::isName(string m_name) {
return name == m_name;
}

class Stack {
    public:
    list<Layer*> layer;
    list<Layer*>::iterator iter;
};

int main() {
Stack stack;
stack.layer.push_back(new Layer);
stack.layer.push_back(new Layer("snail", true));
stack.layer.push_back(new Layer("squirrel", false));

string search = "snail";
stack.layer.remove_if(bind2nd(mem_fun(&Layer::isName), search));

return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ lambda stl bind list

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