Versions Compared

Key

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

...

Code Block
    <screen name="person">
        <section>
            <actions>
                <script location="component://practice/webapp/practice/WEB-INF/actions/Person.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonPracticeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <platform-specific>
                            <html>
                                <html-template location="component://practice/webapp/practice/Person.ftl"/>
                            </html>
                        </platform-specific>
                    </decorator-section>
                </decorator-screen>       
            </widgets>
        </section>
    </screen>





Step - 6 : Now do the needful for rendering this screen in change the controller.xml file so it points to the new screen, as we did earlier.
Now again run the application and see the results.Output Screen:









...

Events can be written in Java and minilang both. Now the next development which you are going to do will be writting these events.
Events are used for the validation and conversion using Simple Map Processor. The Simple Map Processor Mini-Language performs two primary tasks: validation and conversion. It does this in a context of moving values from one Map to another. The input map will commonly contain Strings, but can contain other object types like Integer, Long, Float, Double, java.sql.Date, Time, and Timestamp.
Before moving any further an important link to go through is : http://docs.ofbiz.org/display/OFBIZ/Mini-Language+Guide#Mini-LanguageGuide-smapFor making an understanding with it implementation will be done by performing following steps:
Step - 1 : For this create another tab in your practice application menu bar for this by Name "Events".
Step - 2 : Now create another menu with two menu item in PracticeMenus.xml file by name "EventMenu". This menu will be having 2 menu Item one will be by name "EventMinilang" and  another by name "EventJava". One will be used to show the form which we will be calling an event which will be in minilang and other will be used to call java event.
Step - 3 : Simply show form on the request of both which will be for creating a new person. Both the forms will be different for calling different events as target in them.

Code Block
<menu name="EventMenu" default-menu-item-name="eventMinilang" default-selected-style="selected"
         type="simple" menu-container-style="button-bar button-style-1" selected-menuitem-context-field-name="headerItem">
      <menu-item name="eventMinilang" title="Create Person --- Event MiniLang">
           <link target="createPracticePersonEventM"/>
      </menu-item>
      <menu-item name="eventJava" title="Create Person --- Event Java">
           <link target="createPracticePersonEventJ"/>
      </menu-item>   
</menu>

...

Step - 2 : Now you have to process the fields comming from the form like

Code Block
String salutation = (String) request.getParameter("salutation");
String firstName = (String) request.getParameter("firstName");

...

Step - 3 : Now prepare a map for the values which you have to pass to the service which you will call "createPracticePerson" . Like

Code Block
Map createPersonCtx = UtilMisc.toMap("salutation", salutation, "firstName", firstName);

...