Delete
Do Record
Setting
Add New Item
Menu List
Title | Content Type | Order | Action | ||||||
---|---|---|---|---|---|---|---|---|---|
{{kb_content.name}} {{kb_content.name}} | {{setValue(content_types, kb_content.content_type)}} | {{kb_content.sort_order}} | Preview Edit Edit Content | ||||||
{{kb_content.name}} | {{setValue(content_types, kb_content.content_type)}} | {{kb_content.sort_order}} | Preview Edit Edit Content | ||||||
No record |
Status: published
Programming, Software and application
2020-10-14 16:12:27
Step 4: Data save in the database
1127
This is complete tutorial to build an application using grails 3.x. There are several parts of tutorial where every part has a specific objective and several steps. So it is a step by step tutorial to build a complete application using grails 3.x.
First of all, we have already a form which is prepared in previous part. Now we just set save action for this form and save method contain following code
def save(Contact contact) { if (contact == null) { transactionStatus.setRollbackOnly() notFound() return } if (contact.hasErrors()) { transactionStatus.setRollbackOnly() respond contact.errors, view:'create' return } contact.save flush:true request.withFormat { form multipartForm { flash.message = message(code: 'default.created.message', args: [message(code: 'contact.label', default: 'Contact'), contact.id]) redirect contact } '*' { respond contact, [status: CREATED] } } }
Done