class Person {
String name
Integer age
String street
String email
}
class PersonController {
def save = {
def personInstance = new Person(params)
personInstance.save(flush:true)
}
}
main.gsp
<g:form controller="person" action="save">
<g:textField name="name" />
<g:textField name="age" />
<g:textField name="street" />
<g:textField name="email" />
<g:submitButton name="save" value="Save" />
</g:form>
What modifications do i have to make in both the controller and the gsp page to render the errors to the gsp page?
You have to set either:
View:
Or:
Change the controller action to
and add this just before your
<g:form>
:Consider running
grails generate-all packagename.Person
and editing the generated controller and GSPs. Of course move yours out of the way first.