Ofbiz:Practice

refer

创建组件

创建目录:

hot-deploy
|____practice
    |____widgets
    |____webapp
        |____practice
            |____WEB-INF
            |____error

然后创建ofbiz-component.xml(hot-deploy/practice/ofbiz-component.xml):

<?xml version="1.0" encoding="UTF-8"?>
<ofbiz-component name="practice"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
    <resource-loader name="main" type="component" />
    <webapp name="practice" title="practice" server="default-server"
        base-permission="OFBTOOLS" location="webapp/practice" mount-point="/practice"
        app-bar-display="false" />
</ofbiz-component>

创建webapp

新建controller.xml :

<?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</description>
    <request-map uri="main"><security https="true" auth="true"/>
        <response name="success" type="view" value="main"/>
    </request-map>
    <view-map name="main" type="screen" page="component://practice/widget/PracticeScreens.xml#main"/>
</site-conf>

新建web.xml:

....
<context-param>
        <param-name>mainDecoratorLocation</param-name>
        <param-value>component://practice/widget/PracticeScreens.xml</param-value>
        <description>The location of the main-decorator screen ...</description>
    </context-param>
...

拷贝一个error.jsp;

创建PracticeScreens.xml:

<?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">
        <section>
            <widgets>
                <label text="Hello Riguz!" />
            </widgets>
        </section>
    </screen>
</screens>

运行即可。

https://localhost:8443/practice/control/main