Set a specific screen as a default page after login in JMIX 2.0

Hi,

I want to a set a screen called Dashboard as a default screen after login in JMIX 2.0. I add a code as below in application.properties file.

jmix.ui.login-view-id = LoginView
jmix.ui.main-view-id = MainView
jmix.ui.default-screen-id = Dashboard

However, it only work when I login first time. After I logout and login again, it doesnt display the Dashboard page anymore. How do i make it to always display default page Dashboard after login

Hi, found a solution already.

In the MainView.java add the code below

 @Override
    public void beforeEnter(BeforeEnterEvent event) {
        // Check if the root path is accessed
        if (event.getLocation().getPath().isEmpty()) {
            // Redirect to the Dashboard route when accessing the root path
            event.forwardTo(Dashboard.class);
        }
    }

Thanks for raising this issue and suggesting a solution!

Actually, there is no jmix.ui.default-screen-id property in Jmix 2.0. We’ll reintroduce it in 2.1:

1 Like

In current JMIX this is now jmix.ui.default-view-id see UI Properties :: Jmix Documentation