It is undeniable that the open-source system OFBiz has very powerful functions and involves too many things. In fact, the most useful thing for us is the following: entity engine, service engine, WebTools, and user permission management.
The first thing to remind you is that when you configure an OFBiz path, do not contain spaces. Otherwise, an error is always prompted, except for information such as scoket write error, will keep you depressed ^_^
We can copy the existing content of OFBiz for user logon authentication. In fact, some methods in the org. OFBiz. securityext. login. loginevents package can be called for processing.
Component definition: component-load.xml, you can adjust the component to be introduced at startup as needed, such as adding a study, definition:
<Load-component-location = "$ {OFBiz. Home}/components/Study"/>
First, you must configure the following items:
1. entityengine. XML: the entity engine configuration is mainly used to configure the data. For example, if you access the data through Oracle, configure localoracle. Note that in the datasource configuration, make sure to configure a property-schema-name = "OFBiz", which is mainly to be able to normally match with the database objects at OFBiz startup. If no configuration is made, every time you try to create an object again, it will report that the object name is occupied.
2. serviceengine. xml: service engine configuration, which basically does not need to be modified much. If necessary, you can optimize some parameters here, such as the number of access threads.
Create a new directory named study under the components directory. Some files in the directory can be copied directly from the template, and then make necessary modifications, involving the modification content:
1. entitygroup. xml & entitymodel object definition (beginning with version 3.0, each object definition can be defined under its own component, rather than being centralized under commonapp ); define the relevant attributes of entities and entities (in fact, it is equivalent to various objects in the database. Note that if you need to associate multiple tables for subsequent data extraction, you also need to define a view-entity) here );
2. Services. xml: Some services can be defined here if necessary;
3. Data: some initial configuration data should be relatively fixed and not changed frequently. You can use WebTool to import the data to the database;
4. SRC: If you need to re-compile the files in this directory after modifying some java source files, you can use the ultraedit tool to configure ant compilation, which is very convenient and recommended, the compiled files are generated under the build directory. The generated files include various class files and some. jar packages (in the lib directory). These jar packages need to be referenced in Web applications. Of course, which packages can be referenced as configurable are described below;
5, ofbiz-component.xml: The main configuration file, need to pay attention to some things:
(1) <classpath type = "jar" location = "build/lib/*"/> This is the jar reference path. I am wondering whether to directly reference the class file, that is, directly set the directory where the class file is located;
(2) Title = "study". This is what we use through AppBar. the content of the FTL file displayed on the buttons displayed on the main interface can be adjusted as needed. To restart OFBiz after adjustment, you can use the hot-deploy directory for release.
For other configurations, it is very easy to see.
The following describes the web application configuration. The two most important files involved in Web application configuration are controller. XML and regions. XML, controller. the XML file mainly configures the request-map, that is, the request ing relationship. All request ing needs to be configured here, that is, the/login that we often see on the web page, if the view-map type is region. the XML file reads the configuration, that is, configuring the processing page referenced by each region (it can be a variety of development languages, such as JSP and FTL ). In addition, in region. the most important part of the XML configuration file is the main_region configuration, which is the configuration of the entire webpage layout, including Header, AppBar, error, content, footer, etc, the AppBar is the configuration of the buttons on the main interface we just mentioned. header, footer, and error are too simple, what we mainly want to modify is displayed on the content section.
Some styles and common definitions used in the webpage are written in main_template.jsp. You also need to configure the referenced files in the attributes of main_region. The style definition file references the images component, so this is also the key and cannot be missing.
Finally, I will give a brief introduction to database access: Database Access is mainly controlled through genericdelegator, including some common methods, such as findall, remove, store, and create. It is not complicated to study the specific usage. Create a genericdelegator first, if it is create or store, you can use the makevalue method to set the values of some fields to genericvalue, and then store or create. For specific syntax, refer to some documents, I haven't checked this item yet.
Most of the documents to be accessed: ofbizchina entity engine Configuration Guide, ofbizchina blockchain (region) Guide, ofbizchina service engine Configuration Guide, ofbizchina JSP tag library guide, of course, the premise of studying OFBiz is to first understand the concept of MVC mode, that is, view-model-control. Otherwise, everything is empty talk.