ofbiz实现oracle平台小例子详解步骤及注意的问题

IntelliJ IDEA与Gradle调试Apache Ofbiz:从环境搭建到漏洞追踪实战 在企业级Java应用开发与安全研究中,集成开发环境(IDE)和构建工具是提升效率的关键。IntelliJ IDEA作为主流的Java IDE,以其智能代码分析和强大的调试器著称,而Gradle作为现代构建工具,提供了灵活的依赖管理和项目配置能力。二者结合,能够为复杂项目提供高效的开发与调试体验。在安全研究领域,这种环境尤为重要,它允许研究人员动态追踪代码执行流,深入分析漏洞原理。以Apache Ofbiz这类大型开源ERP系统为例,其庞大的代码库和复杂的历史版本使得直接进行代码审计和漏洞分析极具挑战。通过配 阅读详情

 一 , 在配置的过程中需要注意一下几点:(请先完成下面的小例子,再进行构建)
1,一般项目都是创建在hot-deploy目录下
2,数据源的配置在D:/ofbiz/framework/entity/configf下的entityengine.xml文件
    其中在配置oracle数据源时需要把schema-name="OFBIZ"属性删除,避免数据库实例不是ofbiz的情况,
    具体的文件内容会复制在文件最后
3 , D:/ofbiz/framework/entity/lib/jdbc需要在该目录下加入ojdbc.jar
4,在D:/ofbiz/framework/base/config目录下有ofbiz-containers.xml,里面定义了ofbiz项目启动时服务的端口,初始为8080
    建议在初期开发是不要更改该端口,如果出现oracle端口和8080冲突时,建议更改oracle的http服务的端口,因为在ofbiz
    提供的一些application中很多地方是把端口写死为8080,如果更改不方便访问一些应用程序
5 , 更改完数据源配置时需要重构ofbiz目录,具体做法如下
 在ofbiz根目录下,运行指令ant clean-all ,接着运行指令ant run-install
 执行完这两个ant的时候就已经完成了对数据库的映射
 注:如果是郭刚提供的ofbiz框架,在ant前,需要把D:/ofbiz/specialpurpose目录下的build.xml文件中的meetingroom/build.xml删除
6 , 框架重构完成以后,在用 java  -Xmx512m -jar ofbiz.jar进行启动时,可能会出现job_sandbox表出现异常,这时
 需要把该表中的RUN_BY_INSTANCE_ID字段全部手动填上值,并commit, 注:我全是负值为1

 

二 , 简单增删改查实例实现详细步骤:
 step1 :    首先在hot-deploy创建一个新的项目目录:hellosix
   在该目录下新建ofbiz-component.xml
   该xml文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<ofbiz-component name="hellosix"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd ">
    <!-- define resource loaders; most common is to use the component resource loader -->
    <resource-loader name="main" type="component"/>
    <!-- place the config directory on the classpath to access configuration files -->
    <classpath type="dir" location="config"/>
    <classpath type="dir" location="dtd"/>
    <classpath type="dir" location="script"/>
    <!-- load single or multiple external libraries -->
    <classpath type="jar" location="build/lib/*"/>
    <!-- entity resources: model(s), eca(s), group, and data definitions -->
    <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
    <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/>
    <service-resource type="model" loader="main" location="servicedef/services.xml"/>
    <!-- web applications; will be mounted when using the embedded Jetty container -->
    <webapp name="hellosix"
        title="UserExample"
        server="default-server"
        location="webapp/hellosix"
        base-permission="OFBTOOLS"
        mount-point="/hellosix"/>
</ofbiz-component>


 step2 :    在hellosix目录下创建一个entitydef目录
   在该目录下创建entitygroup.xml  , entitymodel.xml两个文件
   entitygroup.xml文件内容为:
   <?xml version="1.0" encoding="UTF-8"?>
   <entitygroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
    xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/entitygroup.xsd ">
         <entity-group group="org.ofbiz" entity="UserExample"/>
          </entitygroup>

   entitymodel.xml文件内容为:
   <?xml version="1.0" encoding="UTF-8"?>
   <entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
       xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/entitymodel.xsd ">
       <!-- ========================================================= -->
       <!-- ======================== Defaults ======================= -->
       <!-- ========================================================= -->
       <title>Entity of an Open For Business Project Component</title>
       <description>None</description>
       <copyright>Copyright 2001-2006 The Apache Software Foundation</copyright>
       <author>None</author>
       <version>1.0</version>
       <entity entity-name="UserExample" package-name="org.ofbiz.hellosix" title="UserExample Entity">
    <field name="userexampleId" type="id-ne"><!-- primary sequenced ID --></field>
    <field name="userexampleName" type="name"></field>
    <field name="description" type="description"></field>
    <field name="longDescription" type="very-long"></field>
    <field name="comments" type="comment"></field>
    <field name="userexampleSize" type="numeric"></field>
    <field name="userexampleDate" type="date-time"></field>
    <prim-key field="userexampleId"/>
       </entity>
   </entitymodel>

   到此为止我们就定义好了Schema,注意:在ofbiz-component.xml,里面有对entitymodel.xml和entitygroup.xml的引用


step3 : 启动ofbiz 访问url:http://localhost:8080/webtools/constrol/main ,点击右上方的"Login"
            用admin/ofibz 登陆,登陆进入后选择链接"Check/Update DataBase" ,这是会出现Check 的Form
     该表单验证Schema是否改变,默认的GroupName为org.ofbiz.
     点击"Check/Update DataBase"按钮,Ofbiz会检验变动情况,显示出一个详细列表,你可以检查一下
     我们刚才建的"UserExample",如果没有,那可能就是我们前面定义的xml文件有问题了,按照之前的不步骤
     重新再做一遍

     到现在为止,我们就成功的完成了,UserExample Schema的创建.

step 4 : 下面我们创建数据操作层
             在d:/ofbiz/hot-deploy/hellosix/ 下创建servicedef目录
      在该文件下创建services.xml文件
      该文件内容如下:

      <?xml version="1.0" encoding="UTF-8"?>
  <services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
   xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/services.xsd ">
      <description>UserExample Services</description>
      <vendor>OFBiz</vendor>
      <version>1.0</version>
      <!-- Example & Related Services -->
      <service name="createUserExample" default-entity-name="UserExample" engine="simple"
       location="org/ofbiz/hellosix/UserExampleServices.xml" invoke="createUserExample" auth="false">
   <description>Create a UserExample</description>
   <auto-attributes include="pk" mode="OUT" optional="false"/>
   <auto-attributes include="nonpk" mode="IN" optional="true"/>
   <override name="userexampleName" optional="false"/>
      </service>
      <service name="updateUserExample" default-entity-name="UserExample" engine="simple"
         location="org/ofbiz/hellosix/UserExampleServices.xml" invoke="updateUserExample" auth="false">
   <description>Update a UserExample</description>
   <auto-attributes include="pk" mode="IN" optional="false"/>
   <auto-attributes include="nonpk" mode="IN" optional="true"/>
      </service>
      <service name="deleteUserExample" default-entity-name="UserExample" engine="simple"
         location="org/ofbiz/hellosix/UserExampleServices.xml" invoke="deleteUserExample" auth="false">
   <description>Delete a Example</description>
   <auto-attributes include="pk" mode="IN" optional="false"/>
      </service>
     </services>

 
step 5 :    在D:/ofbiz/hot-deploy/hellosix/下
  创建目录/script/org/ofbiz/hellosix
  在该目录下创建UserExampleServices.xml
  该文件内容如下:
  <?xml version="1.0" encoding="UTF-8"?>
  <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
   xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd ">
      <!-- Example methods -->
      <simple-method method-name="createUserExample" short-description="create a UserExample" login-required="false">
   <make-value entity-name="UserExample" value-name="newEntity"/>
   <sequenced-id-to-env sequence-name="UserExample" env-name="newEntity.userexampleId"/> <!-- get the next sequenced ID -->
   <field-to-result field-name="newEntity.userexampleId" result-name="userexampleId"/>
   <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
   <create-value value-name="newEntity"/>
      </simple-method>  
      <simple-method method-name="updateUserExample" short-description="update a UserExample" login-required="false">
   <entity-one entity-name="UserExample" value-name="lookedUpValue"/>
   <!-- handle statusId change stuff; first put the current statusId in the oldStatusId result -->
   <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
   <store-value value-name="lookedUpValue"/>
      </simple-method>
      <simple-method method-name="deleteUserExample" short-description="delete a Example" login-required="false">
   <entity-one entity-name="UserExample" value-name="lookedUpValue"/>
   <remove-value value-name="lookedUpValue"/>
      </simple-method>
  </simple-methods>


上面定义了:增,删,改的数据操作方法的定义
这几个方法在services.xml中提供了用户权限的检查

 

step6 :     创建显示层
  在D:/ofbiz/hot-deploy/hellosix/widget/hellosix下创建目录
  widget/hellosix
  在该目录下创建CommonScreen.xml,UserExampleForms.xml,UserExampleMenus.xml,UserExampleScreens.xml
  其中CommonScreen.xml内容如下:

  <?xml version="1.0" encoding="UTF-8"?>
   <screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
    xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-screen.xsd ">
       <screen name="main-decorator">
    <section>
        <actions>
     <!-- base/top/specific map first, then more common map added for shared labels -->
     <property-map resource="ExampleUiLabels" map-name="uiLabelMap" global="true"/>
     <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
     <set field="layoutSettings.companyName" from-field="uiLabelMap.ExampleCompanyName" global="true"/>
     <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.ExampleCompanySubtitle" global="true"/>
     <set field="layoutSettings.headerImageUrl" value="/images/ofbiz_logo.jpg" global="true"/>
     <!-- <set field="layoutSettings.headerMiddleBackgroundUrl" value="" global="true"/> -->
     <!-- <set field="layoutSettings.headerRightBackgroundUrl" value="" global="true"/> -->
     <set field="activeApp" value="userexample" global="true"/>
     <set field="appheaderTemplate" value="component://hellosix/webapp/hellosix/includes/appheader.ftl" global="true"/>
        </actions>
        <widgets>
     <include-screen name="GlobalDecorator" location="component://common/widget/CommonScreens.xml"/>
        </widgets>
    </section>
       </screen>
       <screen name="main">
    <section>
        <widgets>
     <decorator-screen name="main-decorator">
         <decorator-section name="body">
      <container style="screenlet">
          <container style="screenlet-header">
       <label style="boxhead" text="Example Main Page"/>
          </container>
          <container style="screenlet-body">
       <section>
           <condition><if-empty field-name="userLogin"/></condition>
           <widgets>
        <container><label text="${uiLabelMap.ExampleMessage}"/></container>
           </widgets>
       </section>
       <container><label text="${uiLabelMap.ExampleWelcome}"/></container>
          </container>
      </container>
         </decorator-section>
     </decorator-screen>
        </widgets>
    </section>
       </screen>
       <screen name="login">
    <section>
        <widgets>
     <decorator-screen name="main-decorator">
         <decorator-section name="body">
      <platform-specific>
          <html><html-template location="component://common/webcommon/login.ftl"/></html>
      </platform-specific>
         </decorator-section>
     </decorator-screen>
        </widgets>
    </section>
       </screen>
   </screens>

 


  UserExampleForms.xml内容如下:


  <?xml version="1.0" encoding="UTF-8"?>
   <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
    xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd ">
       <form name="ListUserExamples" type="list" list-name="examples"
     paginate-target="FindUserExample">
    <actions>
        <entity-condition entity-name="UserExample"><order-by field-name="description"/></entity-condition>
    </actions>
    <field name="userexampleId" title="${uiLabelMap.ExampleExampleId}" widget-style="buttontext">
        <hyperlink also-hidden="false" description="${userexampleId}" target="EditUserExample?userexampleId=${userexampleId}"/>
    </field>
    <field name="userexampleName" title="${uiLabelMap.CommonName}"><display/></field>
    <field name="description" title="${uiLabelMap.CommonDescription}"><display/></field>
     <field name="deleteexampleId" title="${uiLabelMap.ExampleExampleId}" widget-style="buttontext">
        <hyperlink also-hidden="true" description="${userexampleId}" target="deleteUserExample?userexampleId=${userexampleId}"/>
    </field>
       </form>
       <form name="EditUserExample" type="single" target="updateUserExample" title="" default-map-name="userexample">
           <alt-target use-when="userexample==null" target="createUserExample"/>
     <auto-fields-service service-name="updateUserExample"/>
    <field use-when="userexample!=null" name="userexampleId" title="${uiLabelMap.ExampleExampleId}" tooltip="${uiLabelMap.CommonNotModifRecreat}"><display/></field>
    <field use-when="userexample==null&amp;&amp;userexampleId==null" name="userexampleId" title="${uiLabelMap.ExampleExampleId}"><ignored/></field>
    <field use-when="userexample==null&amp;&amp;userexampleId!=null" name="userexampleId" title="${uiLabelMap.ExampleExampleId}"><display description="${uiLabelMap.CommonCannotBeFound}: [${userexampleId}]" also-hidden="false"/></field>        
    <field name="description" title="${uiLabelMap.CommonDescription}"/>
    <field name="submitButton" use-when="example==null" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
    <field name="submitButton" use-when="example!=null" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
       </form>
       </forms>

 


  UserExampleMenus.xml内容如下:
  <?xml version="1.0" encoding="UTF-8"?>
   <menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
    xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-menu.xsd ">     
       <menu name="EditUserExample" default-selected-style="selected"
        menu-container-style="button-bar button-style-1"
        selected-menuitem-context-field-name="tabButtonItem"
        type="simple">
    <menu-item name="EditUserExample" title="${uiLabelMap.ExampleExample}">
        <link target="EditUserExample?userexampleId=${userexampleId}"/>
    </menu-item>
       </menu>
   </menus>

 

  UserExampleScreens.xml内容如下:

  <?xml version="1.0" encoding="UTF-8"?>
   <screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
    xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-screen.xsd ">
       <screen name="FindUserExample">
    <section>
        <actions>
     <set field="headerItem" value="UserExample"/>
     <set field="titleProperty" value="PageTitleFindExample"/>
        </actions>
        <widgets>
     <decorator-screen name="main-decorator" location="component://hellosix/widget/hellosix/CommonScreens.xml">
         <decorator-section name="body">
      <section>
          <widgets>
       <container><label style="head1">${uiLabelMap.${titleProperty}}</label></container>
       <container style="button-bar"><link target="EditUserExample" text="${uiLabelMap.ExampleNewExample}" style="buttontext"/></container>
       <include-form name="ListUserExamples" location="component://hellosix/widget/hellosix/UserExampleForms.xml"/>
          </widgets>
          <fail-widgets>
       <label style="head3">${uiLabelMap.ExampleViewPermissionError}</label>
          </fail-widgets>
      </section>
         </decorator-section>
     </decorator-screen>
        </widgets>
    </section>
       </screen>
       <screen name="CommonExampleDecorator">
    <section>
        <actions>
     <set field="headerItem" value="UserExample"/>
     <set field="userexampleId" from-field="parameters.userexampleId"/>
     <entity-one entity-name="UserExample" value-name="userexample"/>
        </actions>
        <widgets>
     <decorator-screen name="main-decorator" location="component://hellosix/widget/hellosix/CommonScreens.xml">
         <decorator-section name="body">
      <section>
         <widgets>
       <section>
           <condition>
        <not><if-empty field-name="userexample"/></not>
           </condition>
           <widgets>
        <include-menu name="EditUserExample" location="component://hellosix/widget/hellosix/UserExampleMenus.xml"/>
        <container style="button-bar"><link target="EditUserExample" text="${uiLabelMap.ExampleNewExample}" style="buttontext"/></container>
        <container style="button-bar"><label style="head1">${uiLabelMap.${titleProperty}}</label><label style="head2"> ${uiLabelMap.CommonFor} "${userexample.userexampleName}" [${userexampleId}]</label></container>
           </widgets>
       </section>
       <decorator-section-include name="body"/>
          </widgets>
          <fail-widgets>
       <label style="head3">${uiLabelMap.ExampleViewPermissionError}</label>
          </fail-widgets>
      </section>                   
         </decorator-section>
     </decorator-screen>
        </widgets>
    </section>
       </screen>
       <screen name="EditUserExample">
    <section>
        <actions>
     <set field="titleProperty" value="PageTitleEditExample"/>
     <set field="tabButtonItem" value="EditUserExample"/>
     <set field="userexampleId" from-field="parameters.userexampleId"/>
     <entity-one entity-name="UserExample" value-name="userexample"/>
        </actions>
        <widgets>
     <decorator-screen name="CommonExampleDecorator">
         <decorator-section name="body">
      <include-form name="EditUserExample" location="component://hellosix/widget/hellosix/UserExampleForms.xml"/>
         </decorator-section>
     </decorator-screen>
        </widgets>
    </section>
       </screen>
       </screens>

step 7 :    下面需要在controller.xml进行mapping的设置
  在D:/ofbiz/hot-deploy/hellosix/下创建目录webapp/hellosix
  在D:/ofbiz/hot-deploy/hellosix/webapp/hellosix下
  创建一个文件index.jsp,创建三个目录error,includes, WEB-INF
  index.jsp内容如下:
  <%response.sendRedirect("control/main");%>


  在D:/ofbiz/hot-deploy/hellosix/webapp/hellosix/error创建error.jsp
  error.jsp内容如下:

  <%@ page import="org.ofbiz.base.util.*" %>
  <html>
  <head>
  <title>Open For Business Message</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  </head>

  <% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>

  <body bgcolor="#FFFFFF">
  <div align="center">
    <br/>
    <table width="100%" border="1" height="200">
      <tr>
        <td>
   <table width="100%" border="0" height="200">
     <tr bgcolor="#CC6666">
       <td height="45">
         <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
       </td>
     </tr>
     <tr>
       <td>
         <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "/n", "<br/>")%></font></div>
       </td>
     </tr>
   </table>
        </td>
      </tr>
    </table>
  </div>
  <div align="center"></div>
  </body>
  </html>


  在D:/ofbiz/hot-deploy/hellosix/webapp/hellosix/includes下创建文件appheader.ftl
  该文件内容如下:

  <#assign selected = headerItem?default("void")>

  <div id="app-navigation">
    <h2>${uiLabelMap.ExampleApplication}</h2>
    <ul>
      <li<#if selected = "main"> class="selected"</#if>><a href="<@ofbizUrl>main</@ofbizUrl>">${uiLabelMap.CommonMain}</a></li >
      <li<#if selected = "Example"> class="selected"</#if>><a href="<@ofbizUrl>FindUserExample</@ofbizUrl>">${uiLabelMap.ExampleExample}</a></li >
     
      <#if userLogin?has_content>
        <li class="opposed"><a href="<@ofbizUrl>logout</@ofbizUrl>">${uiLabelMap.CommonLogout}</a></li >
      <#else>
        <li class="opposed"><a href="<@ofbizUrl>${checkLoginUrl?if_exists}</@ofbizUrl>">${uiLabelMap.CommonLogin}</a></li >
      </#if>
    </ul>
    <br class="clear" />
  </div>


  在D:/ofbiz/hot-deploy/hellosix/webapp/hellosix/WEB-INF下
  创建二个文件controller.xml,web.xml
  其中controller.xml内容如下:

  <?xml version="1.0" encoding="UTF-8"?>
  <site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
   xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/site-conf.xsd ">
      <description>Example Component Site Configuration File</description>
      <owner>Copyright 2001-2006 The Apache Software Foundation</owner>
      <errorpage>/error/error.jsp</errorpage>
     
      <!-- event handlers -->
      <handler name="java" type="request" class="org.ofbiz.webapp.event.JavaEventHandler"/>
      <handler name="soap" type="request" class="org.ofbiz.webapp.event.SOAPEventHandler"/>
      <handler name="service" type="request" class="org.ofbiz.webapp.event.ServiceEventHandler"/>
      <handler name="simple" type="request" class="org.ofbiz.webapp.event.SimpleEventHandler"/>

      <!-- view handlers -->
      <handler name="screen" type="view" class="org.ofbiz.widget.screen.ScreenWidgetViewHandler"/>
      <handler name="screenfop" type="view" class="org.ofbiz.widget.screen.ScreenFopViewHandler"/>
      <handler name="jsp" type="view" class="org.ofbiz.webapp.view.JspViewHandler"/>
      <handler name="http" type="view" class="org.ofbiz.webapp.view.HttpViewHandler"/>
     
      <!--
        These can be used to return the reports as views; make sure the classes are compiled and available
   <handler name="datavision" type="view" class="org.ofbiz.webapp.view.DataVisionViewHandler"/>
   <handler name="jasperreportspdf" type="view" class="org.ofbiz.webapp.view.JasperReportsPdfViewHandler"/>
   <handler name="jasperreportsxml" type="view" class="org.ofbiz.webapp.view.JasperReportsXmlViewHandler"/>
      -->
   
    
      <postprocessor>
   <!-- Events to run on every request after all other processing (chains exempt) -->
   <!-- <event type="java" path="org.ofbiz.webapp.event.TestEvent" invoke="test"/> -->
      </postprocessor>

      <!-- Security Mappings -->
      <request-map uri="checkLogin" edit="false">
   <description>Verify a user is logged in.</description>
   <security https="true" auth="false"/>
   <event type="java" path="org.ofbiz.webapp.control.LoginWorker" invoke="checkLogin" />
   <response name="success" type="view" value="main"/>
   <response name="error" type="view" value="login"/>
      </request-map>
      <request-map uri="login">
   <security https="true" auth="false"/>
   <event type="java" path="org.ofbiz.webapp.control.LoginWorker" invoke="login"/>
   <response name="success" type="view" value="main"/>
   <response name="error" type="view" value="login"/>
      </request-map>
      <request-map uri="logout">
   <security https="true" auth="true"/>
   <event type="java" path="org.ofbiz.webapp.control.LoginWorker" invoke="logout"/>
   <response name="success" type="request" value="checkLogin"/>
   <response name="error" type="view" value="main"/>
      </request-map>
      <!-- End of Security Mappings -->

      <!-- Request Mappings -->
      <request-map uri="main"><security https="true" auth="false"/><response name="success" type="view" value="main"/></request-map>
      <request-map uri="authview"><security https="true" auth="false"/><response name="success" type="view" value="main"/></request-map>
      <request-map uri="setSessionLocale">
   <security https="true" auth="false"/>
   <event type="java" path="org.ofbiz.common.CommonEvents" invoke="setSessionLocale"/>
   <response name="success" type="view" value="main"/>
   <response name="error" type="view" value="main"/>
      </request-map>

      <!-- Example Requests -->
      <request-map uri="FindUserExample"><response name="success" type="view" value="FindUserExample"/></request-map>
      <request-map uri="EditUserExample"><response name="success" type="view" value="EditUserExample"/></request-map>
      <request-map uri="createUserExample">
   <security https="true" auth="false"/>
   <event type="service" path="" invoke="createUserExample"/>
   <response name="success" type="view" value="EditUserExample"/>
   <response name="error" type="view" value="EditUserExample"/>
      </request-map>
      <request-map uri="updateUserExample">
   <security https="true" auth="false"/>
   <event type="service" path="" invoke="updateUserExample"/>
   <response name="success" type="view" value="EditUserExample"/>
   <response name="error" type="view" value="EditUserExample"/>
      </request-map>
   <request-map uri="deleteUserExample">
   <security https="true" auth="false"/>
   <event type="service" path="" invoke="deleteUserExample"/>
   <response name="success" type="view" value="FindUserExample"/>
   <response name="error" type="view" value="FindUserExample"/>
      </request-map>

     
      
    <!-- end of request mappings -->

      <!-- View Mappings -->
      <view-map name="error" page="/error/error.jsp"/>

      <view-map name="main" type="screen" page="component://unifyuser/widget/unifyuser/CommonScreens.xml#main"/>
      <view-map name="login" type="screen" page="component://unifyuser/widget/unifyuser/CommonScreens.xml#login"/>

      <view-map name="FindUserExample" type="screen" page="component://unifyuser/widget/unifyuser/UserExampleScreens.xml#FindUserExample"/>
      <view-map name="EditUserExample" type="screen" page="component://unifyuser/widget/unifyuser/UserExampleScreens.xml#EditUserExample"/>
      <!-- end of view mappings -->
  </site-conf>


  web.xml文件内容如下:

  <?xml version="1.0" encoding="UTF-8"?>
   <web-app>
       <display-name>Open For Business - Example Component</display-name>
       <description>Example Component of the Open For Business Project</description>
      
       <context-param>
    <param-name>localDispatcherName</param-name><param-value>example</param-value>
    <description>A unique name used to identify/recognize the local dispatcher for the Service Engine</description>
       </context-param>   
       <context-param>
    <param-name>entityDelegatorName</param-name><param-value>default</param-value>
    <description>The Name of the Entity Delegator to use, defined in entityengine.xml</description>
       </context-param>

       <filter>
    <filter-name>ContextFilter</filter-name>
    <display-name>ContextFilter</display-name>
    <filter-class>org.ofbiz.webapp.control.ContextFilter</filter-class>
    <init-param><param-name>disableContextSecurity</param-name><param-value>N</param-value></init-param>
    <init-param>
        <param-name>allowedPaths</param-name>
        <param-value>/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value>
    </init-param>
    <init-param><param-name>errorCode</param-name><param-value>403</param-value></init-param>
    <init-param><param-name>redirectPath</param-name><param-value>/control/main</param-value></init-param>       
       </filter>
       <filter-mapping><filter-name>ContextFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>

       <listener><listener-class>org.ofbiz.webapp.control.ControlEventListener</listener-class></listener>
       <listener><listener-class>org.ofbiz.webapp.control.LoginEventListener</listener-class></listener>
       <!-- NOTE: not all app servers support mounting implementations of the HttpSessionActivationListener interface -->
       <!-- <listener><listener-class>org.ofbiz.webapp.control.ControlActivationEventListener</listener-class></listener> -->
    
       <servlet>
    <servlet-name>ControlServlet</servlet-name>
    <display-name>ControlServlet</display-name>
    <description>Main Control Servlet</description>
    <servlet-class>org.ofbiz.webapp.control.ControlServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping><servlet-name>ControlServlet</servlet-name><url-pattern>/control/*</url-pattern></servlet-mapping>

       <session-config><session-timeout>60</session-timeout><!-- in minutes --></session-config>

       <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
       </welcome-file-list>
   </web-app>

 

到此一个简单的增删改的操作就算完成了,访问地址为:
URL: http://localhost:8080/hellosix/control/main

 

 

三 , 快速了解ofbiz配置
     ofbiz框架中的几个重要文件说明
   1 , component-load.xml
       路径:ofbiz/application/
       作用:定义了所有在OFBIZ启动时需要加载的应用程序的位置。所以,当你创建了新的应用程序时,别忘了在该文件中添加应用程                   序的位置信息。在ofbiz/hot-deploy/目录下的应用程序不需要在component-load.xml里定义,ofbiz启动时会自动加载 所有
      hot-deploy下的内容。
       经典内容:
                <load-component component-location="${ofbiz.home}/applications/content" />

   2 , ofbiz-component.xml
 路径:基于ofbiz的任何应用程序根目录下,如ofbiz/applications/accounting/
 作用:指出该应用程序数据模型(<entity-resource>),商业逻辑(<service-resource>),web应用程序(<webapp.../>)的位置.
   经典内容:
   <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml" />
   <service-resource type="model" loader="main" location="servicedef/services_agreement.xml" />
   <webapp name="accounting" title="Accounting" server="default-server" location="webapp/accounting" base-   permission="OFBTOOLS,ACCOUNTING" mount-point="/accounting" />

   3 , web.xml
   位置:(以accounting为例)accounting/webapp/accounting/WEB-INF
   作用:配置main servlet(s),控制后台服务器(如tomcat server),及一些相关参数。
   经典内容:
   <servlet>
   <servlet-name>ControlServlet</servlet-name>
   <display-name>ControlServlet</display-name>
   <description>Main Control Servlet</description>
   <servlet-class>org.ofbiz.webapp.control.ControlServlet</servlet-class>
   <load-on-startup>1</load-on-startup>
   </servlet>
 <servlet-mapping>
   <servlet-name>ControlServlet</servlet-name>
   <url-pattern>/control/*</url-pattern>
   </servlet-mapping>
 
  4 , controller.xml
   位置:(以accounting为例)accounting/webapp/accounting/WEB-INF
   作用:负责控制接收到的请求request。任何到来的请求,无论是屏幕请求,还是服务请求或事件请求,都要经过controller.xml的处       理,然后转交给相应的相应的部分处理。
   经典内容:
   <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://accounting/widget/CommonScreens.xml#main" />
   (当请求"main"到来时,在controller.xml中,先找到<request-map uri="main">,根据其value="main",继续向下找到view-map  name="main",最后得到该请求该返回的页面位置page="component://accounting/widget /CommonScreens.xml#main" )

ofbiz实现oracle平台小例子详解步骤及注意的问题.doc ofbiz实现oracle平台小例子详解步骤及注意的问题.doc,很详细 立即下载

相关推荐

ofbiz一个完整例子

ofbiz一个完整例子,ofbiz学习实战例子.

ofbiz 使用 oracle 开发遇到的一些问题

转自 http://ajava.org/course/open/14640.html 转自 http://job6688.spaces.live.com/blog/cns!FA3F6195E8CF95F7!236.entry     ofbiz默认的数据库为derby,这个当然不能在生产环境中使用,而且也不方便调试和管理。虽然ofbiz也支持很多的开源数据库,例如mysql等,但是我们这里...

jiasudu 170

利用netns做自环Iperf测试

netns可以让一台机器上模拟多个网络设备,是网络虚拟化的重要组成,将不同类型的网络应用隔离。一个net namespace有自己独立的路由表,iptables策略,设备管理。本文利用netns模拟网络来实现单机上网卡自环上的iperf测试或其他网络测试。

weixin_42414349的博客 3370

OFBiz安装的Oracle中导入数据的必须的sql语句

select 'alter table ' || table_name || ' disable constraint ' || constraint_name ||';' from user_constraints where constraint_type='R' ; select 'alter table ' || table_name || ' enable constrain...

jiasudu 172

告别浏览器崩溃!EasyPlayer.js长时间播放FLV视频内存泄漏排查指南

本文针对EasyPlayer.js长时间播放FLV视频导致浏览器内存泄漏和崩溃的问题,提供了一套系统性排查与解决方案。核心策略包括将视频编码从H.265转为H.264以降低解码压力,以及将传输协议从HTTP-FLV切换至WebRTC以优化资源管理。文章还详细介绍了播放器实例生命周期管理、浏览器开发者工具监控等精细化排查手段,帮助开发者实现稳定、长时间的多路视频播放。

weixin_29229055的博客 173

UE5网络模块实战:属性复制、RPC与联机开发踩坑指南

多人联机开发中,网络同步是核心难题。UE5网络模块以服务器权威为基础,通过Actor复制、RPC和所有权机制实现多端状态一致。理解属性复制与OnRep回调、区分Server/Client/Multicast RPC的适用场景,是构建稳定联机架构的关键。本文结合数字孪生与多端协作场景,探讨如何将渲染与逻辑分离,并针对打包后网络失效、端口防火墙、崩溃排查等工程实践问题给出解决方案。通过蓝图接口解耦表现层,利用C++创建StaticMesh组件实现服务器逻辑与客户端表现分离,同时注意专用服务器不加载渲染依赖(如D

weixin_29010003的博客 272

安装ofbiz tomcat oracle

安装ofbiz tomcat oracle转自:http://www.mscto.com/Javatec/26876705.html ofbiz安装这个文章描述的是安装ofbiz在oracle tomcat环境ofbiz2.11提供的缺省的web server是jetty,由于我比较习惯tomcat,因此打算把他转移到tomcat上来。ofbiz2.11提供的却省的数据

北京上空的鹰 1230

扫地机器人:从仿真到决策,一个完整SLAM导航系统的自研之路

本文详细记录了从零开始自研扫地机器人SLAM导航系统的全过程,涵盖ROS-Gazebo仿真系统搭建、地图预处理优化、全覆盖规划算法迭代等关键技术。通过三次算法升级,最终实现92%的清洁效率,并分享DWA调参、状态机设计等实战经验,为开发者提供从仿真到落地的完整解决方案。

weixin_29053695的博客 352

ofbiz中使用Oracle 数据库配置解决时间格式问题

ofbiz 代码: http://svn.apache.org/repos/asf/ofbiz/branches/release11.04 切换到oracle,创建自己的数据库账户,脚本如下。请修改自己的用户名和密码 create user ofbiz identifi

East271536394 1148

洛奇 服务器文件,MabinogiG20S2 [洛奇G20服务端]

Code:Titles:>set_title /id: /add /remove Parameters for titles>set_title /id:60001 /add add devcat title>set_title /id:60001 /remove remove devcat title===========================...

weixin_30813385的博客 4301

matlab中高频变压器怎么找,干货|手把手教你绕制高频变压器

原标题:干货|手把手教你绕制高频变压器绕制一个变压器所需材料:磁芯、骨架、各种铜线、麦拉胶带。变压器参数:磁芯:EE22原边:134T(1-3脚),辅助:32T(5-4脚),输出:15T(10-9脚)原边电感:1380±10%uH漏感:≤44uH引脚分布图: 特别注意:绕制方法为网上下载,其中变压器绕制方法是对的,但其中存在着很多问题(比如,正规变压器的绕组的头和尾是要添加铁氟龙套管的,每一层之间...

weixin_30895121的博客 2123

安装ofbiz+tomcat+oracle

<!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--><script type="text/javascript"

zgqtxwd的专栏 589

基于STM32设计的盲人智能导盲杖

本设计基于STM32单片机,开发了一种面向视障人群的智能导盲杖系统。系统以STM32F103C8T6为核心控制器,集成了超声波测距、语音提示、环境光检测、GPS定位及4G通信等多种功能模块。

642

ofbiz框架的四种情景安装指南

一、ofbiz 用自身数据库安装1. 由 binary 安装:由 binary 安装非常简单, 以下是安装方法:下载ofbiz-2.0-beta1-complete.tar.gz, 注意不是ofbiz-2.0-beta1.tar.gz.tar xvzf ofbiz-2.0.beta1-complete.tar.gzcd tomcat/bin./ofbiz.sh startgaleon http://localhost:8080/webtools2. 由 CVS 安装:由 CVS 安装要稍微复杂一些. 由于

1729

SAP ABAP 缓冲同步揭秘——从 DDLOG 表到 RSDBBUF3 的完整实践指南

DDLOG 看似一张不起眼的系统表,却承担着 SAP 多实例环境下的数据一致性重任。通过掌握其字段意义、解析方法及周边监控工具,你可以在性能与一致性之间找到最佳平衡;通过精细化的参数管理与主动刷新策略,更能在关键业务场景中确保“数据永远是最新的”。愿本文能成为你日常排障与架构决策的参考手册。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 312

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

搞笑的解决ofbiz宕掉问题

公司近两年对网管产品线进行升级,新的版本采用了ofbiz框架,这玩意本身实现了一个比较完善的mvc三层架构的实现:V层推荐使用ftl或者form widget;m层提供了entity engine;c提供了service engine实现。还聚合了一些别的常见的专门话的开源项目。 这个周期也是第一个正式在客户边大规模应用的一个周期,主要是在ofbiz聚合shark的基础上实现工单...

zhaominhe的博客 245

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

ofbiz四种情景安装指南(hsql/mysql/oracle+tomcat/apache)

一、ofbiz 用自身数据库安装 1. 由 binary 安装: 由 binary 安装非常简单, 以下是安装方法: 下载ofbiz-2.0-beta1-complete.tar.gz, 注意不是ofbiz-2.0-beta1.tar.gz. tar xvzf ofbiz-2.0.beta1-complete.tar.gz cd tomcat/bin ./ofbiz.sh start ga...

jiasudu 203

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

ofbiz将数据导入本地库

我用的是ORACLE 11J (创建实例时出现一些问题,后期是用dos命令创建的用户,具体问题稍后在写) 1. 修改数据库配置ofbiz/framework/entity/config/entityengine.xml -->

CreateComingGOGO的专栏 1003

磁吸充电接口设计核心:磁路、触点与公差三重协同

磁吸充电接口已从消费电子配件升级为关键人机交互部件,其本质是电磁学、微纳材料与精密结构的交叉技术。原理上依赖磁极排布精度与触点镀层电化学稳定性协同,技术价值体现在提升插拔寿命、抑制温升、保障防水防尘可靠性;典型应用于TWS耳机仓、电动牙刷、便携投影仪等需高频无感连接的设备。当前行业痛点集中于磁体高温退磁、触点氧化失效及0.05mm级结构公差失控——这正是Customized Magnetic Charging Connectors和触点镀层耐蚀性两大热词所指向的工程攻坚核心。

weixin_33937778的博客 363

apacheOfbiz

一、ofbiz 用自身数据库安装 1. 由 binary 安装: 由 binary 安装非常简单, 以下是安装方法: 下载ofbiz-2.0-beta1-complete.tar.gz, 注意不是ofbiz-2.0-beta1.tar.gz. tar xvzf ofbiz-2.0.beta1-complete.tar.gz cd tomcat/bin ./ofbiz.sh start gal...

weixin_34290390的博客 225
上一篇: AB型水瓶座
下一篇: Singleton(单例)模式
lcb521
博客等级 码龄18年 7粉丝 12原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值