`

OFBIZ.12.4的一个简单例子

阅读更多
   最近在研究OFBIZ,在12.4的版本下写一个最简单的例子。


   1. 首先在hot-deploy下面建各种文件以及文件夹,结构如图所示



   2.ofbiz-component.xml文件如下
<?xml version="1.0" encoding="UTF-8"?>
<ofbiz-component name="simple" 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="simple" 
         title="Simple" 
         server="default-server"
         base-permission="OFBTOOLS" 
         location="webapp/simple"
         mount-point="/simple"
         app-bar-display="false"/>
    
</ofbiz-component>


  3.SimpleScreens.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 simple"/>
            </widgets>
        </section>
    </screen>
</screens>


   4.index.jsp 内容如下
<%response.sendRedirect("control/main");%>

  
   5. web.xml内容如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app> 
    <display-name>simple</display-name> 
    <description>The First Hello World Application</description> 

    <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> 
    <context-param> 
        <param-name>localDispatcherName</param-name> 
        <param-value>simple</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://simple/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>

    <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-list> 
</web-app> 


   6. 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://simple/widget/SimpleScreens.xml#main"/>
       <!-- change the path to the following if the above doesn't work for you -->
       <!-- <view-map name="main" type="screen" page="component://practice/webapp/practice/widget/PracticeScreens.xml#main"/> -->
 
       <!-- end of view mappings -->
</site-conf>


   7. 运行的结果如下:


   注意几点:
   1. 在这里不要main.ftl文件, 所展示的内容就是SimpleScreens.xml里面的东西
   2. opentaps里面的东西有点老,虽然是Si写的
  • 大小: 20.4 KB
  • 大小: 23.7 KB
分享到:
评论

相关推荐

    Apache.OFBiz.Development

    1. OFBiz介绍与安装:OFBiz是一个开源的企业自动化软件套件,它提供了构建企业应用程序所需的各种功能,比如电子商务、订单处理等。文件中提到了2008年的版本,这意味着可能有较新的版本替代。安装OFBiz涉及到获取源...

    浅谈OFBIZ.doc

    为了能够顺利进行 OFBIZ 的开发与测试工作,首先需要搭建一个良好的开发环境。 **1. 安装 JDK 1.5.0** - **下载 JDK**: - 访问 [http://java.sun.com](http://java.sun.com/) 下载 `jdk-1_5_0_04-windows-i586-p...

    OFBIZ.txt(同表不同字段计算)

    OFBIZ的同一个表的不同字段之间的加减乘除等的计算公式

    ofbiz一个完整例子

    OFBiz,全称为Open For Business Project,是一个开源的企业应用框架,用于构建企业级的电子商务、供应链管理和CRM等复杂业务系统。本示例将带你逐步了解如何在OFBiz中创建一个完整的应用实例,从实体创建到服务定义...

    ofbiz资料大全

    里面是下载地址,如果逆向开发ofbiz,只要下载它就绝对没错了 Apache+OFBiz+开发初学者指南.rar OFBiz开发快速入门.rar OFBiz-技术文档.rar OFBiz API中文版.rar Apache OFBiz Cookbook Sep 2010.rar Opentaps ...

    Ofbiz16.11.05运行及开发环境搭建等

    - **Ofbiz实体引擎(九) 多租户**:实体引擎支持多租户架构,允许在一个OFBiz实例上管理多个独立的业务环境,每个环境有自己的数据和配置。 - **Ofbiz权限判断语法**和**权限设计详解**:OFBiz具有精细的权限管理...

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

    通过遵循上述步骤和注意事项,你可以在Oracle平台上成功实现OFBiz,并创建一个简单的增删改查示例。这个过程将帮助你理解OFBiz与Oracle数据库集成的基础,并为进一步开发更复杂的业务应用打下基础。

    OFBiz教程_-_初学者的开发指南

    本教程将带领您完成一个简单的应用程序——“Hello World”级别的示例项目,以此为基础逐步介绍OFBiz的各个方面。以下是一些关键知识点: 1. **环境搭建**:如何设置OFBiz开发环境,包括安装必要的软件工具和配置...

    Ofbiz 入门教程

    下面是一个简单的 `entitymodel_study.xml` 文件示例: ```xml &lt;!DOCTYPE entitymodel PUBLIC "-//OFBiz//DTD EntityModel//EN" "http://www.ofbiz.org/dtds/entitymodel.dtd"&gt; &lt;title&gt;Entity of an Open For ...

    ofbiz快速搜索

    资源名称不太对,当时写插件没管这些。 ofbiz快速查询controller.xml中url的路径,service服务名称,entity和viewentity名称,快捷键ctrl+shift+v

    ofbiz sso 单点登录

    1. **管理 CAS 用户数据**:可以创建一个新的实体 `SsoUserLogin` 来同步 CAS 用户数据和 `UserLogin` 数据。密码可以存储为明文,或者使用 CAS 加密后的密文。 2. **去除 LDAP 验证**:如果希望简化管理,可以选择...

    一个简单的ofbiz的实例

    别人写的一个ofbiz的一个简单的例子,希望对大家有用,顺便挣点儿积分!

    ofbiz 初学者开发手册

    #### 三、创建第一个应用:“practice” - **步骤1**:在`hot-deploy`目录下创建名为“practice”的子目录。该目录名称需与将要创建的组件名称保持一致。 - **注意**:所有定制化的开发工作应在该目录下进行。 - ...

    Apache OFBiz Cookbook

    其设计目标是为了提供一个灵活且可扩展的平台,支持多种业务流程。 - **特点**: - **模块化架构**:OFBiz 的架构设计使得各个组件之间可以独立工作,同时也能够无缝集成。 - **高度可定制性**:用户可以根据自身...

    apache-ofbiz-16.11.02源码+ofbiz菜鸟笔记+Apache+OFBiz+开发初学者指南

    apache-ofbiz-16.11.02.zip,ofbiz菜鸟笔记,Apache+OFBiz+开发初学者指南.chm

    ofbiz1004运行于外部tomcat6的配置文件

    你只需要下载这个文件包中的配置文件模板,虽后放到ofbiz1004\framework\appserver\templates\tomcat6下替换原来的文件,然后再到ofbiz目录下运行java -jar ofbiz.jar -setup tomcat6 ,完成后会得到一个setup的文件...

    何增耀 2012年《OFBiz集 成 Spring和 Activiti详细设计说明书》

    - Spring配置文件中的`&lt;bean id="echo" class="org.ofbiz.client.Echo"&gt;`定义了一个名为`echo`的Bean,该Bean在Java类`org.ofbiz.client.Echo`中定义了方法,例如`echoString(String value)`,用于通过`...

    OFBiz教程_初学者的开发指南

    通过本教程的学习,初学者可以对OFBiz有一个初步的认识,并能够开始着手创建自己的第一个应用。OFBiz框架的强大之处在于其灵活性和扩展性,而本教程正是帮助开发者入门的关键资源之一。未来的学习过程中,可以进一步...

    ofbiz ofbiz_nutshell.pdf

    《OpenForBusiness in a Nutshell》一文深入探讨了Open For Business(简称OFBiz),一个开源项目,旨在为企业的各种应用程序提供坚实的基础。OFBiz不仅仅是一个普通的开发框架,它还包含了一个复杂的数据模型以及一...

Global site tag (gtag.js) - Google Analytics