看看新的OFBIZ的变化(1)

王朝other·作者佚名  2006-11-17
窄屏简体版  字體: |||超大  

用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.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航