Vaadin 7 on Grails 2.x
  • Introduction
  • Project setup
    • Command Line
    • IntelliJ IDEA
    • Eclipse
    • NetBeans
    • Plugin Configuration
    • Clean up
    • Best Practices
  • Database
    • GORM
      • Create Domain Model
      • Transactions
      • LazyInitializationException
      • Open Session In View I.
      • Open Session In View II.
      • Table Container
    • Groovy SQL
      • Create Sql
      • Execute SQLs
    • MyBatis
      • Configuration
      • Basics
    • JdbcTemplate
      • Create Beans
      • Usage
    • Clean Up With Alternatives
  • Architecture
    • Model View Presenter
  • Spring Autowiring
    • Create Simple Application
    • Application With Navigator
  • UI
    • Re-using GORM Validations
    • Async Push
    • Multiple application
    • SASS Compilation
    • Widgetset Compilation
  • Spring Security
    • Spring Security Dependency
    • Spring Security Basics
    • Secured Navigator
  • Localization
    • Localization Basics
    • Custom MessageSource
  • REST
    • Without using root URL
    • Using root URL for Vaadin app
  • Plugin development
    • Github
    • Development
Powered by GitBook
On this page
  • Step 1
  • Step 2

Was this helpful?

  1. UI

Multiple application

PreviousAsync PushNextSASS Compilation

Last updated 5 years ago

Was this helpful?

Example code is available on .

In grails-app/conf/VaadinConfig.groovy, we can configure URL mapping to Vaadin UI classes. We can define multiple UIs to be accessible from one Grails application.

In this article we will create two new UIs that we will show under different URLs.

Step 1

ClientUI will be available on .

package app

import com.vaadin.server.VaadinRequest
import com.vaadin.ui.Label
import com.vaadin.ui.UI
import com.vaadin.ui.VerticalLayout

class ClientUI extends UI {

    protected void init(VaadinRequest request) {
        VerticalLayout layout = new VerticalLayout()
        layout.setMargin(true)

        Label label = new Label("Client")
        layout.addComponent(label)

        setContent(layout)
    }
}
package app

import com.vaadin.server.VaadinRequest
import com.vaadin.ui.Label
import com.vaadin.ui.UI
import com.vaadin.ui.VerticalLayout

class AdminUI extends UI {

    protected void init(VaadinRequest request) {
        VerticalLayout layout = new VerticalLayout()
        layout.setMargin(true)

        Label label = new Label("Admin")
        layout.addComponent(label)

        setContent(layout)
    }
}

Step 2

Open VaadinConfig.groovy and change the mapping, so the mapping points to the new UIs.

mapping = [
    "/client/*": "app.ClientUI",
    "/admin/*": "app.AdminUI"
]

Now we can start up the application and access both URLs to see each is mapped to different UI class.

And AdminUI that will be mapped to

github.com/vaadin-on-grails/multiple-ui-application
http://localhost:8080/client
http://localhost:8080/server