看看新的OFBIZ的变化(1)

用ofbiz开发已经2年了, 出于稳定性的考虑, 我们目前仍然用的还是当时的3.0, 现在ofbiz已经加入了apache, 有了很多变化, 也该看看现在的版本具体怎么样, 于是从 http://svn.apache.org/repos/asf/incubator/ofbiz/trunk取得了最新版本.
 
发现目录结构和以前大有不同, 所有框架性质的部分被放在了framework下, 基础的app放在application下, 热发布app仍然是hot-deploy. 我们的开发都是采用热发布的, 所以废话少说, 先看看热发布app是否和以前有所不同吧. 建立一个hello1 app看看. 从accounting复制了最少需要的文件. 稍做修改, 建立了这样一个结构:
 
hot-deploy/hello1/
    webapp/
        hello1/
            error/
                error.jsp
            WEB-INF/
                controller.xml
                web.xml
            index.jsp
            main.ftl
    ofbiz-component.xml

ofbiz-component.xml
<?xml version="1.0" encoding="UTF-8"?>
<ofbiz-component name="hello1"
        xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation=" http://www.ofbiz.org/dtds/ofbiz-component.xsd">
    <resource-loader name="main" type="component"/>
    <webapp name="hello1"
         title="My First OFBiz Application"
         server="default-server"
         location="webapp/hello1"
         mount-point="/hello1"
         app-bar-display="false"/>    
</ofbiz-component>
index.jsp
<meta http-equiv="refresh" content="0;URL=/hello1/control/main">
 
main.ftl
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>HELLO</h1>
<p>Hello world!</p>
</body>
</html>
 
controller.xml保留login/logout方面的request map和view map, 其他accounting的删除, 下面的保留并修改
    <!-- User Request Mappings -->
    <request-map uri="main">
        <response name="success" type="view" value="main"/>
    </request-map>
    <!-- End of User Request Mappings -->
 
    <!-- View Mappings -->
    <view-map name="error" page="/error/error.jsp"/>
    <!-- End of View Mappings -->
 
    <!-- User View Mappings -->
    <view-map name="main" type="ftl" page="main.ftl"/>
    <!-- End of User View Mappings -->
 
error.jsp完全照搬ofbiz原来的
web.xml完全照搬ofbiz原来的

 
1, 首先发现中它有几个XML文件中使用了XML Schema而不再是DTD了.
2, 从web.xml中发现 一些类比如ControlServlet, ContextFilter, ControlEventListener和LoginEventListener全部移到了包org.ofbiz.webapp.control里面. 此外多了
    <context-param>
        <param-name>mainDecoratorLocation</param-name>
        <param-value>component://accounting/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>
Widget可以替代以前jpublish.xml的page/template/action结构. hello1仍然使用ftl类型的view , 不使用widget.
 
startofbiz, 访问 http://localhost:8080/hello1/, main.ftl的内容显示了出来, 从log中也发现web container改用了tomcat了, 毕竟是加入了apache嘛.
 
下一步将试试widget.
  
 
 
 
 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值