小编emi*_*lan的帖子

HTML5中是否有minlength验证属性?

看起来字段的minlength属性<input>不起作用.

HTML5中是否还有其他属性可以帮助我设置字段值的最小长度?

html5 html5-validation

587
推荐指数
9
解决办法
57万
查看次数

如何更改或删除HTML5表单验证默认错误消息?

比如我有一个textfield.该字段是必填字段,仅需要数字且值的长度必须为10.当我尝试提交长度为5的值的表单时,将显示默认错误消息:Please match the requested format

<input type="text" required="" pattern="[0-9]{10}" value="">
Run Code Online (Sandbox Code Playgroud)
  1. 如何更改HTML 5表单验证错误的默认消息?
  2. 如果第一点可以完成,那么有没有办法创建一些属性文件并在该文件中设置自定义错误消息?

validation html5

137
推荐指数
9
解决办法
18万
查看次数

如何从字节数组中提取文件扩展名

我在数据库中有字节数组.

如何从java中的字节数组中提取文件扩展名(mime/type)?

java sql bytearray mime-types

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

在Git中编辑一个已经被推送的错误提交消息

我做了一个Git提交和推送,但在评论中写了完全错误的东西.

如何更改评论?我已经将提交推送到遥控器.

git git-push git-commit

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

使用Google OAuth API检索出生日期和婚姻状况

我正试图通过Google OAuth api检索出生日期和婚姻状况.我得到低于设定范围,有提到信息 https://www.googleapis.com/auth/userinfo.profile&https://www.googleapis.com/auth/userinfo.email.请求网址为https://www.googleapis.com/oauth2/v2/userinfo

{
 "id": "my_id",
 "email": "test@gmail.com",
 "verified_email": true,
 "name": "full_name",
 "given_name": "first_name",
 "family_name": "last_name",
 "link": "https://plus.google.com/xxxxxxx",
 "picture": "https://xxxxxxxxx/photo.jpg",
 "gender": "male",
 "locale": "en"
}
Run Code Online (Sandbox Code Playgroud)

我的个人资料中设有生日和婚姻状况,但我无法获得此信息.请帮我理解是什么问题.

grails oauth oauth-2.0 google-oauth

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

由于错误,无法测试我的grails应用程序

这是我的域类,我想测试它.

class TekEvent {
    String city
    String name
    String organizer
    String venue
    Date startDate
    Date endDate
    String description

    static constraints = {
        name()
        city()
        description(maxSize: 5000)
        organizer()
        venue()
        startDate()
        endDate()
    }

    String toString(){
        "$name, $city"
    }
}
Run Code Online (Sandbox Code Playgroud)

以下是我的测试课程

@TestFor(TekEvent)
class TekEventTests extends GrailsUnitTestCase {
    void testToString() {
       def tekEvent = new TekEvent(
               name: 'Groovy One',
               city: 'San Francisco, CA',
               organizer: 'Emil Matevosyan',
               venue: 'Moscone center',
               startDate: new Date('6/2/2015'),
               endDate: new Date('6/5/2015'),
               description: 'This conference will cover all...')

        assertEquals 'Groovy One, …
Run Code Online (Sandbox Code Playgroud)

grails junit unit-testing grails-2.0

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

使用ant任务编译Groovy文件

我不明白为什么groovy.compile任务在我尝试运行编译任务时运行.

<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
    <classpath>
        <path refid="compile.classpath"/>
    </classpath>
</taskdef>

<target name="groovy.compile">
    <groovyc srcdir="src/groovytest" destdir="bin/classes"/>
</target>

<target name="compile" description="Compile *.java file" depends="init, groovy.compile">
    <javac srcdir="src" destdir="bin/classes" debug="on" deprecation="true">
        <classpath refid="compile.classpath"/>
    </javac>
</target>
Run Code Online (Sandbox Code Playgroud)

有没有办法用javac ant任务而不是groovyc ant任务编译.groovy?

java ant groovy javac

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

价格输入模式html5

我有输入字段,我想检查价格输入字段值的点存在.该值将如下所示12.00.这是我的代码

<g:textField class="span3" id="price" name="price" required="" pattern="\d+(\.\d{2})?"/>
Run Code Online (Sandbox Code Playgroud)

我写了这样的东西\d+(\.\d{2})?,但收到了错误.有什么建议 ?

regex grails html5

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

由于grails 2.4.4中的IllegalStateException,无法运行集成测试

我使用Grails 2.4.4作为我的应用程序.我为我的控制器写了一个集成测试.

class UserControllerIntegrationSpec extends IntegrationSpec {
    UserController controller = new UserController()

    void "test something"() {
        when:
        controller.request.method = 'POST'
        controller.create()

        then:
        controller.response.status == HttpStatus.OK.value()
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试使用IntelliJ运行测试时,我得到一个例外:

java.lang.IllegalStateException: Could not find ApplicationContext, configure Grails correctly first
    at grails.util.Holders.getApplicationContext(Holders.java:97)
    at grails.test.spock.IntegrationSpec.$spock_initializeSharedFields(IntegrationSpec.groovy:41)
Run Code Online (Sandbox Code Playgroud)

当我使用带test-app命令的控制台运行集成测试时没有问题.PS单元测试工作没有问题.

grails integration-testing intellij-idea spock

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