Hello Everyone,

I am new here and want to thank everyone that has contributed to this
project.  I apologize in advance if the formatting of this becomes
poor.

I am experiencing issues with Part-2 of the "OFBiz Beginner's
Development Guide Using Practice Application".  Part-1 works after i
add:

<handler name="screen" type="view"
class="org.ofbiz.widget.screen.ScreenWidgetViewHandler"/>

to my controller.xml file.

I have made many, many attempts at this, hacking little things here
and there and always get errors  when running the application.  These
have varied depending on what I have changed, but the latest one is
"java.lang.NullPointerException".  I ended up unzipping the
practice.zip attachment and using sections of the files from it.

I have listed the steps below and commented where necessary:

-----------------Step 1:  My CommonScreens.xml file is as
follows:----------------------------

<?xml version="1.0" encoding="UTF-8"?>

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd";>
    <screen name="main-decorator">
        <!-- The main-decorator screen 'wraps' or 'decorates' all of
the screens in the
            practice component. It is also decorated - by the
GlobalDecorator screen. -->
        <section>
            <actions>
                <!-- base/top/most specific map first, then more
common map added for shared labels.
                    Setting things up this way enables a component to
redefine the more common
                    UI labels. -->
                <property-map resource="CommonUiLabels"
map-name="uiLabelMap" global="true"/>
                <property-map resource="PracticeUiLabels"
map-name="uiLabelMap" global="true"/>
                <!-- The layoutSettings field is a Map that is used to
pass variables and layout
                    information to the GlobalDecorator and any
templates that it uses. -->
                <set field="layoutSettings.companyName"
from-field="uiLabelMap.PracticeCompanyName" global="true"/>
                <set field="activeApp" value="practice" global="true"/>
                <set field="applicationMenuName"
value="PracticeAppBar" global="true"/>
                <set field="applicationMenuLocation"
value="component://practice/widget/PracticeMenus.xml" global="true"/>
            </actions>
            <widgets>
                <include-screen name="GlobalDecorator"
location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>

    <screen name="CommonPracticeDecorator">
        <section>
            <widgets>
                <decorator-screen name="main-decorator">
                    <decorator-section name="body">
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
</screens>

-----------------------Step 2----------------------------------

I copied the contents of PracticeMenus.xml file from the practice.zip

-----------------------Step 3-------------------

Person.groovy created

------------------------Step 4----------------

Person.ftl  created

------------------------Step 5--------------------

Here is my PracticeScreens.xml file:

<?xml version="1.0" encoding="UTF-8"?>

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd";>

    <screen name="Main">
        <section>
            <actions>
                <set field="headerItem" value="main"/>
                <set field="titleProperty" value="PageTitlePracticeMain"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonPracticeDecorator"
location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <label text="${uiLabelMap.PracticeApplication}"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="Person">
        <section>
            <actions>
                <set field="headerItem" value="person"/>
                <set field="titleProperty" value="PageTitlePracticePerson"/>
                <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>

</screens>

Here is my PracticeMenus.xml file:

<?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="PracticeAppBar" default-menu-item-name="main"
id="app-navigation" type="simple" title="Practice Application"
        default-selected-style="selected"
selected-menuitem-context-field-name="headerItem">
        <menu-item name="main" title="Main"><link target="main"/></menu-item>
        <menu-item name="person" title="Person"><link
target="person"/></menu-item>
        <menu-item name="personForm" title="Person Form"><link
target="personForm"/></menu-item>
        <menu-item name="events" title="Events"><link
target="events"/></menu-item>
        <menu-item name="eca" title="ECA"><link target="eca"/></menu-item>
        <menu-item name="serviceGroup" title="Service Group"><link
target="serviceGroup"/></menu-item>
        <menu-item name="interface" title="Interface"><link
target="interface"/></menu-item>
        <menu-item name="Logout" title="Logout"
align-style="col-right" selected-style="selected">
            <condition><not><if-empty field-name="userLogin"/></not></condition>
            <link target="logout"/>
        </menu-item>
        <menu-item name="Login" title="Login" align-style="col-right"
selected-style="selected">
            <condition><if-empty field-name="userLogin"/></condition>
            <link target="${checkLoginUrl}"/>
        </menu-item>
    </menu>

    <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>

    <menu name="EcaMenu" default-menu-item-name="seca"
default-selected-style="selected"
         type="simple" menu-container-style="button-bar
button-style-1" selected-menuitem-context-field-name="headerItem">
         <menu-item name="seca" title="Create Person --- SECA">
             <link target="seca"/>
         </menu-item>
         <menu-item name="eeca" title="Create Person --- EECA">
             <link target="eeca"/>
         </menu-item>
     </menu>
</menus>

--------------------Step 6--------------------------

Here is my controller.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd";>

       <include
location="component://common/webcommon/WEB-INF/common-controller.xml"/>
       <description>Practice Component Site Configuration File</description>
       <owner>Copyright 2001-2008 The Apache Software Foundation</owner>
       <!-- Event Handlers -->

       <handler name="screen" type="view"
class="org.ofbiz.widget.screen.ScreenWidgetViewHandler"/>

       <!-- Request Mappings -->

        <!-- Request Mappings -->
       <request-map uri="main">
           <security https="false" auth="true"/>
           <response name="success" type="view" value="main"/>
       </request-map>
       <request-map uri="person">
           <security https="false" auth="true"/>
           <response name="success" type="view" value="Person"/>
       </request-map>
       <request-map uri="personForm">
           <security https="false" auth="true"/>
           <response name="success" type="view" value="PersonForm"/>
       </request-map>
       <!-- end of request mappings -->

       <!-- View Mappings -->

       <view-map name="main" type="screen"
page="component://practice/widget/PracticeScreens.xml#Main"/>
       <view-map name="Person" type="screen"
page="component://practice/widget/PracticeScreens.xml#Person"/>
       <!-- end of view mappings -->

</site-conf>




When I run the application I get the "java.lang.NullPointerException"
error.  I am sure I am making a trivial mistake, but any help with
this would be appreciated.

Many Thanks!!

Reply via email to