Register and use Main Window Layou

I use v7.2.14. Based on the section Main Window Layout. " The platform includes the standard main window implementation in /com/haulmont/cuba/web/app/mainwindow/mainwindow.xml XML descriptor and corresponding AppMainWindow controller class. The standard implementation can be extended in the project, like any other application screen."

But I obtain the error when I use the code of Example of an extending screen:

<window xmlns=""
  1. Where do I register the extended MainWindow?
  2. What is the code to register the custom MainWindow?
  3. Can I use difeferent MainWindow depending on the user to login?



AppMainWindow and its mainwindow.xml descriptor are considered legacy. It is better to use main window based on If you have to use the legacy main window, you should register it in the web-screens.xml of the WEB module. For instance, the extended AppMainWindow:

Extended main window
<window xmlns=""
        <split id="foldersSplit">
            <workArea id="workArea">
public class ExtAppMainWindow extends AppMainWindow {

registration in the web-screens.xml:

<screen-config xmlns="">
    <screen id="extMainWindow" template="com/company/demoapp/web/screens/main/legacy/ext-mainwindow.xml"/>

Also, you should set the app property with screen id: cuba.web.mainScreenId=extMainWindow.

The id of the main screen is used by the framework and should be defined in the So you can set only one main screen, but you can hiding components based on the user roles.

Note that Studio provides easy way to create or extend screens:


thank you for your answer. The documentation does not say that this is legacy. Treats it as current from v7.2.
My project created with V7.2.14 is not legacy. I was looking for a way to make a custom main window.


  1. can you update the example from section to customize a standard main window?
  2. Where I register ten main window and the class?

Thank you

Since v7.0 screens based on AbstractWindow, AbstractLookup, etc are considered legacy API (see Screen Controller).

Unfortunately, I cannot find the section in the 7.2 documentation. Do you mean this example?
About main and login screens you can read in Root Screens section.

You can create the main screen using Studio.

  1. In the CUBA project tree do right click on the Screens folder and choose: New → Screen


  1. In the opened dialog select “Main screen with side menu” template

  1. Configure name and id of the screen.
  2. Then will be created controller and its descriptor. As controller uses @UiController annotation you don’t need to register it. Studio will add cuba.web.mainScreenId app property to the

See attached demo project: (82.3 KB)

Thank you