Create Domain Model
Step 1
grails create-domain-class com.app.ItemStep 2
package com.app
class Item {
String label
static constraints = {
}
}Step 3
Step 4

Last updated
grails create-domain-class com.app.Itempackage com.app
class Item {
String label
static constraints = {
}
}
Last updated
import com.app.Item
class BootStrap {
def init = { servletContext ->
new Item(label: 'First').save()
new Item(label: 'Second').save()
new Item(label: 'Third').save()
new Item(label: 'Fourth').save()
}
def destroy = {
}
}import com.app.Item
import com.vaadin.server.VaadinRequest
import com.vaadin.ui.Label
import com.vaadin.ui.UI
import com.vaadin.ui.VerticalLayout
class MyUI extends UI {
@Override
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout()
layout.setMargin(true)
List<Item> items = Item.findAll()
for (Item item : items) {
String label = item.label
layout.addComponent(new Label(label))
}
setContent(layout)
}
}