看看新的OFBIZ的变化(1)

开发者在线 Builder.com.cn 更新时间:2008-03-27作者:牛牛 来源: CSDN

本文关键词: 变化 OFBiz Web开发

用ofbiz开发已经2年了, 出于稳定性的考虑, 我们目前仍然用的还是当时的3.0, 现在ofbiz已经加入了apache, 有了很多变化, 也该看看现在的版本具体怎么样, 取得了最新版本.
 
发现目录结构和以前大有不同, 所有框架性质的部分被放在了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=" 
        xsi:noNamespaceSchemaLocation="
    <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嘛.
 

用户评论

  • 用户名
  • 评论内容