标签:des style blog http color 使用 os strong
参考文档 https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide
1 <?xml version="1.0" encoding="UTF-8"?> 2 <ofbiz-component name="practice" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd"> 5 <resource-loader name="main" type="component"/> 6 <webapp name="practice" 7 title="Practice" 8 server="default-server" 9 base-permission="OFBTOOLS" 10 location="webapp/practice" 11 mount-point="/practice" 12 app-bar-display="false"/> 13 </ofbiz-component>
a. ofbiz通过ofbiz-component.xml文件识别此模块
b. 节点(resource-loader name)可以灵活设置,此处设置为main。type告诉ofbiz我们要加载一个component
1 <resource-loader name="main" type="component"/>
c. 节点webapp有很多属性,通常如下:
1 <webapp name="practice" 2 title="Practice" 3 server="default-server" 4 base-permission="OFBTOOLS" 5 location="webapp/practice" 6 mount-point="/practice" 7 app-bar-display="false"/>
name : web应用名称。
title : 应用的标题,将被展示在顶部导航中。
server : ofbiz通过此处值知道使用的是什么server。
base-permission :
location : 默认跟路径
mount-point : 访问此服务的URL,本例中应为:localhost:8080/practice。
app-bar-display :
在目录hot-deploy/practice下创建文件夹webapp,这个目录下包括模块的所有webapp相关文件。
webapp下内容遵循J2EE webapp标准。
在目录hot-deploy/practice/webapp下创建文件夹practice(为webapp名称)。
注意:一个模块可以有多个webapp,例如marketing模块有两个webappp(marketing和sfa);
在目录hot-deploy/practice/webapp/practice下创建WEB-INF文件夹:
一个OFBiz web application 需要放置两个配置文件(controller.xml 和 web.xml )。
a. controller.xml : 告诉OFBiz一个请求过来该如何处理,通过哪个action去处理,通过那个page去渲染。
b. web.xml : 告诉OFBiz 此web applation 可用的资源(database and business logic access),怎样去处理web相关问题,比如欢迎页面、重定向、错误页面等。
1 <context-param> 2 <param-name>webSiteId</param-name> 3 <param-value>PRACTICE</param-value> 4 <description>A unique ID used to look up the WebSite entity to get information about catalogs, etc.</description> 5 </context-param> 6 <context-param> 7 <param-name>localDispatcherName</param-name> 8 <param-value>practice</param-value> 9 <description>A unique name used to identify/recognize the local dispatcher for the Service Engine</description> 10 </context-param> 11 <context-param> 12 <param-name>mainDecoratorLocation</param-name> 13 <param-value>component://practice/widget/PracticeScreens.xml</param-value> 14 <!-- change the path to the following if the above doesn‘t work for you --> 15 <!-- <param-value>component://practice/webapp/practice/widget/PracticeScreens.xml</param-value> --> 16 <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> 17 </context-param>
1 <?xml version="1.0" encoding="UTF-8"?> 2 <site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd"> 4 <include location="component://common/webcommon/WEB-INF/common-controller.xml"/> 5 <description>Practice Component Site Configuration File</description> 6 <owner>Copyright 2001-2009 The Apache Software Foundation</owner> 7 <handler name="screen" type="view" class="org.ofbiz.widget.screen.ScreenWidgetViewHandler"/> 8 <!-- Request Mappings --> 9 <request-map uri="main"> 10 <security https="false" auth="false"/> 11 <response name="success" type="view" value="main"/> 12 </request-map> 13 <!-- end of request mappings --> 14 <!-- View Mappings --> 15 <view-map name="main" type="screen" page="component://practice/widget/PracticeScreens.xml#main"/> 16 <!-- change the path to the following if the above doesn‘t work for you --> 17 <!-- <view-map name="main" type="screen" page="component://practice/webapp/practice/widget/PracticeScreens.xml#main"/> --> 18 19 <!-- end of view mappings --> 20 </site-conf>
在目录hot-deploy/practice/webapp/practice下创建文件夹error,并且在此文件夹创建error.jsp
在目录hot-deploy/practice下创建文件夹widget,并且创建PracticeScreens.xml文件
1 <?xml version="1.0" encoding="UTF-8"?> 2 <screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd"> 4 <screen name="main"> 5 <section> 6 <widgets> 7 <label text="This is first practice"/> 8 </widgets> 9 </section> 10 </screen> 11 </screens>
http://localhost:8080/practice/control/main
OFBiz进阶之HelloWorld(一)创建热部署模块,布布扣,bubuko.com
标签:des style blog http color 使用 os strong
原文地址:http://www.cnblogs.com/yanchuanblog/p/3866830.html