Moqui Example question

Hi,
I am new to Moqui and I come from spring framework and spring boot background. I am trying to figure out the flow of Moqui starting from URL path. I am able to download moqui and able to run it locally. I looked at the documentation to figure out the variables that are available in the screens. Where is the variable “sri” defined and made available in the screen. Also in the code below, will the code “${sri.renderSubscreen()}” render the default-item subscreen qapps (qapps.xml has <text type="html" location="component://webroot/screen/includes/WebrootVue.qvt.ftl"/>)

<subscreens default-item="qapps">
        <subscreens-item name="toolstatic" location="component://tools/screen/toolstatic.xml" menu-include="false"/>
        <!-- add UNDECORATED (or self-decorating) app roots here -->
    </subscreens>
    <widgets>
        <render-mode>
            <text type="html" location="component://webroot/screen/includes/Header.html.ftl" no-boundary-comment="true"/>
            <text type="xsl-fo" location="component://webroot/screen/includes/Header.xsl-fo.ftl" no-boundary-comment="true"/>
        </render-mode>
        <render-mode><text template="true">${sri.renderSubscreen()}</text></render-mode>
        <render-mode>
            <text type="html" location="component://webroot/screen/includes/Footer.html.ftl"/>
            <text type="xsl-fo"><![CDATA[${sri.getAfterScreenWriterText()}</fo:flow></fo:page-sequence></fo:root>]]></text>
        </render-mode>
    </widgets>

The system exposes a context object in every HTTP request / response cycle. That context is by default populated with various things including ec which is ExecutionContext.java. The Execution Context is like the master class or combined file that holds all the major subsystems including web, logging, user, service, security and so on. One of these main subsystems is called the ScreenFacade which holds the ScreenRender maker makeRender() that is responsible for rendering the screen (which is where you are). Thus by default moqui will populate the context with an sri ScreenRenderImpl.groovy which implements ScreenRender.java

So in short, everything comes from the context object, which you can investigate by just showing the whole thing, for example print the context object ${context} in any screen and see what you get back.

Yes exactly, It will see what is the default sub-screen under qapps.xml and render that, unless the path explicity has a subscreen defined such as https://host/qapps/MyScreen

1 Like

Thank you for the explanation. It is really helpful.