Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
 <screen name="CommonPracticeDecorator">
      <section>
          <widgets>
             <decorator-section name="body">
                              <decorator-section-include name="body"/>                     
             </decorator-section>
          </widgets>
      </section>
</screen>

...

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-menu.xsd">
    <menu name="MainAppBar" title="PracticeApplication" extends="CommonAppBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
        <menu-item name="main" title="Main"><link target="main"/></menu-item>
    </menu>
</menus>

Include this menus file in your CommonPracticeDecorator as follows:

Code Block

<screen name="CommonPracticeDecorator">
        <section>
            <widgets>
                <include-menu location="component://practice/widget/PracticeMenus.xml" name="PracticeAppBar"/>
                <decorator-section-include name="body"/>
            </widgets>
        </section>
    </screen>

Step - 3: Create the sub-directory "actions" inside the WEB-INF directory.
In this directory we will create the scripting files. Scripting files are used to prepare data on fly. These files will be groovy files. Earlier we were using bsh(beanshell) files. This is a script which is used to fetch the data from database on the fly for the UI.
Reference : Tips & Tricks while working with Groovy & http://groovy.codehaus.org/. While working in groovy always be conscious about the imported classes and packages. Import only those which have been used in your file. For putting log messages use methods from "Debug" class just do this practice from the beginning itself. So create a file by name Person.groovy in this actions directory which will be fetching all the records from the entity "Person". At this moment this is really going to be the small code for doing this (a single line) like

...

Step - 6 : Now change the controller.xml file so it points to the new screen, as we did earlier.
Now again run the application and observe the results by giving http://localhost:8080/practice/control/PersonImage Added .

Tip
titleHint

If the output screen does not contain the menu as shown below, you will most likely need to change auth="falsetrue" to auth="false" in your controller.xml for the menu to come up.

Output Screen :
Image Added

Now moving to create a form for showing the content of Person entity on the screen:(Using Form Widget)

...