看起来字段的minlength属性<input>不起作用.
HTML5中是否还有其他属性可以帮助我设置字段值的最小长度?
比如我有一个textfield.该字段是必填字段,仅需要数字且值的长度必须为10.当我尝试提交长度为5的值的表单时,将显示默认错误消息:Please match the requested format
<input type="text" required="" pattern="[0-9]{10}" value="">
Run Code Online (Sandbox Code Playgroud)
我在数据库中有字节数组.
如何从java中的字节数组中提取文件扩展名(mime/type)?
我做了一个Git提交和推送,但在评论中写了完全错误的东西.
如何更改评论?我已经将提交推送到遥控器.
我正试图通过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)
我的个人资料中设有生日和婚姻状况,但我无法获得此信息.请帮我理解是什么问题.
这是我的域类,我想测试它.
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) 我不明白为什么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?
我有输入字段,我想检查价格输入字段值的点存在.该值将如下所示12.00.这是我的代码
<g:textField class="span3" id="price" name="price" required="" pattern="\d+(\.\d{2})?"/>
Run Code Online (Sandbox Code Playgroud)
我写了这样的东西\d+(\.\d{2})?,但收到了错误.有什么建议 ?
我使用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 ×4
html5 ×3
java ×2
ant ×1
bytearray ×1
git ×1
git-commit ×1
git-push ×1
google-oauth ×1
grails-2.0 ×1
groovy ×1
javac ×1
junit ×1
mime-types ×1
oauth ×1
oauth-2.0 ×1
regex ×1
spock ×1
sql ×1
unit-testing ×1
validation ×1