Mainscreen - after login - automatic open screen

Hi,

How can I by default from the MainScreen java open a default screen?

kr,

Tim

Hello!

You can use the jmix.ui.defaultScreenId application property. And your MainScreen should contain the following code:

@Autowired
private ScreenTools screenTools;

@Subscribe
public void onAfterShow(AfterShowEvent event) {
    screenTools.openDefaultScreen(
            UiControllerUtils.getScreenContext(this).getScreens());
    screenTools.handleRedirect();
}
1 Like

So jmix.ui.defaultScreenId in the application.properties works :slight_smile:

Thank you!