小编Dan*_*dio的帖子

Spring MVC 3表单绑定

我有一个简单的HTML表单:

<form id="marketplaceForm" enctype="multipart/form-data" method="post">
<select name="category">
    <option selected ></option>
    <option value="Sales">Sales</option>
    <option value="Marketing" >Marketing</option>
</select>
<textarea type="text" id="marketplaceDesc" name="description" value="" class="creattbleArea"></textarea>
<input type="text" id="marketplaceName" name="templateName" >
<input type="file" id="marketplaceLogo" name="logo">
<input type="submit" value="Save" id="update" />
<input type="text" id="marketplacePrice" name="price">
</form>
Run Code Online (Sandbox Code Playgroud)

我提交时需要自动绑定此表单.这很好用:

@RequestMapping(value = "/.....", method = RequestMethod.POST)
public String PublishForm() {        
Run Code Online (Sandbox Code Playgroud)

但是这会引发以下错误:

HTTP状态400 - 客户端发送的请求在语法上不正确

@RequestMapping(value = "/PublishApplication.htm", method = RequestMethod.POST)
public String PublishForm(@RequestParam("templateName") String templateName,
                           @RequestParam("category") String category,
                           @RequestParam("price") String price,
                           @RequestParam("description") String description
                           ) {
Run Code Online (Sandbox Code Playgroud)

谁能帮我?

更新: …

java jsp spring-mvc

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

Lambda + Python +退出代码

我遇到了一个用Python编写的简单AWS Lambda函数的问题。

当我运行Lambda函数时,我的代码正在按预期运行,结果是正确的,但仍然以错误代码(退出代码)结尾:"Process exited before completing request",这导致Lambda运行3次(异步)。

您是否有最佳实践来管理Lambda的退出代码?

#!/usr/bin/python

import boto3
import sys
import tweepy
import datetime

session = boto3

# Init s3 client
s3 = session.resource('s3')

def get_data_and_push(s3_bucket, s3_key, user):
    # Retrieve CSV file
    try:
        dest = s3.Object(s3_bucket, s3_key)
        dest.download_file(tmpfile)
    except Exception, e:
        print 'An error occured while trying to download CSV file'
        print 'This exception has been thrown :'
        print e
        sys.exit(1)

    # Authenticate to Twitter
    try:
        auth = tweepy.OAuthHandler(t_consumer_key, t_consumer_secret)
        auth.set_access_token(t_access_token_key, t_access_token_secret)
        api = tweepy.API(auth) …
Run Code Online (Sandbox Code Playgroud)

python amazon-web-services aws-lambda

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

为什么在JPA Hibernate中更新查询; 所有属性都在SQL中更新

我正在使用JPA和Hibernate.当我修改对象的一个​​属性并更新它时; 生成的SQL显示所有列都已更新!为什么不只更新修改后的列?有没有办法实现这一点,因为我觉得会更加优化.

sql hibernate jpa

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

使用 docker-dind 时,如何让非 root 用户访问 docker?

我正在尝试使用 docker-dind 运行 Go CD 代理来自动构建我的一些 docker 映像。

我无法让用户go访问 docker 守护进程。

当我尝试访问 docker info 时,我得到以下信息:

[go] Task: /bin/sh ./builder.shtook: 2.820s
[START]
[USER]  go
[TAG]  manual

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.32/containers/fish/angular-cli/json: dial unix /var/run/docker.sock: connect: permission denied
Sending build context to Docker daemon  3.072kB

Step 1/8 : FROM node:8-alpine
 ---> 4db2697ce114
Step 2/8 : MAINTAINER jack@fish.com
 ---> Using cache
 ---> 22f46bf6b4c1
Step 3/8 : VOLUME /usr/local/share/.cache/yarn/v1
 ---> Using …
Run Code Online (Sandbox Code Playgroud)

docker go-cd docker-dind

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