0
我是grails的新手。我想驗證文本字段並在屏幕上顯示錯誤消息。誰可以幫我這個事。爲eg.lastName不輸入。Grails框架中的Textfield驗證
這裏是我的代碼 Person.groovy 類Person {
String firstName
String lastName
int age
static constraints = {
lastName(nullable:false, blank:false)
}
GSP
名字
<label for="firstName">FirstName</label>
<g:textField name="firstName" value="${person.firstName}"></g:textField><br/>
<label for="age">Age</label>
<g:textField name="age" value="${person.age}"/><br/>
<g:actionSubmit value ="save" action="save"/>
我試過上面的但它不工作。我是否需要進行任何驗證設置?我試圖在智能
什麼是不工作? – injecteer 2014-10-09 13:01:08