ofbiz小Demo实例

创建一个ofbiz实例(由apache官网copy过来):

1. 通常将实例创建在hot-deploy文件下,我们这个例子也是:

1.1 创建文件夹hot-deploy/practice

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

1.3 创建文件夹hot-deploy/practice/webapp

   创建文件夹hot-deploy/practice/webapp/practice

           创建文件夹hot-deploy/practice/webapp/practice/WEB-INF(WEB-INF下有 controller.xml 和 web.xml)

      1.4 在hot-deploy/practice/webapp/practice/WEB-INF下创建web.xml(文件我们从ofbiz/framework/example/webapp/birt/WEB-INF/web.xml下copy,但我们需要修改几个地方,修改部分如下)

<context-param>
    <param-name>webSiteId</param-name>
    <param-value>PRACTICE</param-value>
    <description>A unique ID used to look up the WebSite entity to get information about catalogs, etc.</description>
</context-param>
<context-param>
     <param-name>localDispatcherName</param-name>
     <param-value>practice</param-value>
     <description>A unique name used to identify/recognize the local dispatcher for the Service Engine</description>
</context-param>
<context-param>
     <param-name>mainDecoratorLocation</param-name>
     <param-value>component://practice/widget/CommonScreens.xml</param-value>
     <description>The location of the main-decorator screen to use for this webapp; referred to as a context variable in screen def XML files.</description>
</context-param> 

      1.5 hot-deploy/practice/webapp/practice/WEB-INF下创建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 Component Site Configuration File</description>
       <owner>Copyright 2001-2009 The Apache Software Foundation</owner>
       <handler name="screen" type="view" class="org.ofbiz.widget.screen.ScreenWidgetViewHandler"/>
       <!-- Request Mappings -->
       <request-map uri="main">
           <security https="false" auth="false"/>
           <response name="success" type="view" value="main"/>
       </request-map>
       <!-- end of request mappings -->
       <!-- View Mappings -->
       <view-map name="main" type="screen" page="component://practice/widget/PracticeScreens.xml#main"/>
       <!-- end of view mappings -->
</site-conf>
      1.6 创建文件夹 hot-deploy/practice/webapp/practice/error并从ofbiz/framework/example/webapp/birt/error下将error.jsp拷贝过来

      1.7 创建文件夹hot-deploy/practice/widget

      1.8 在hot-deploy/practice/widget下创建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">
        <section>
            <widgets>
                <label text="This is first practice"/>
            </widgets>
        </section>
    </screen>
</screens>

至此,我们第一个小例子已经完成了,现在启动项目:

在控制台(cmd)找到项目路径xxx:\Workspaces\MyEclipse 8.5\ofbiz,运行: java -Xmx256M -jar ofbiz.jar


打开浏览器:http://localhost:8080/practice/control/main

屏幕会出现:





      这样,我们的第一个例子变完成了。后续会更新每个文件的意思及流程


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值