1. in the data layer, OFBiz uses Entity engine as its tool and can interact with the database by 99%. sometimes entity engine is not valid in some places. in this case, you need to write custom JDBC code to interact with the database. 2. the logic layer OFBiz uses the service engine as a tool to call the logic. almost all business logic is implemented as services to improve reuse and facilitate component-based development. we can call our logic synchronously or asynchronously, or even use them as a schedule to call by time. when we call a service, we do not need to know the service location or how to implement it. this means that we can use multiple languages to implement the service. for example, Java, beanshell, and any BSF compiled scripting language (Python, jacl, JavaScript, etc.), we will always call the remote logic through the service engine. Different mechanisms include HTTP, soap, JMS or other mechanisms can also be used to call remote services by creating a simple adapter. obviously, we need to wrap some services in a transaction most of the time so that the service can succeed or fail completely. 3. the display layer often separates the input processing logic, browses the data preparation layer and browses the display template. in this way, not only can logic be reused in web programs, but also independent of fat client programs. 1) the data processing logic is stored in the controller. the XML file should be associated with the request instead of the view. in general, the data processing logic is implemented as a service and called by the server event handle. The service event handle automatically extracts data from the request parameters or attributes, and convert it from the string type to the object type defined in the service definition file. in some cases, the data processing logic cannot be implemented as a service. there are multiple types of event handles related to the request logic. These handles give you more request contexts, but they are not environment unknown like services. one example is to receive uploaded data. another good example is some special pre-processing and parameter verification before being passed to the service processing. note that you can call the service from these custom events. 2) browsing data preparation logic should be linked with the view template. this should be achieved through jpublish defining XML file actions on the page. when a page is divided into multiple templates, the data preparation action should be associated only with an independent small template for which data is prepared. this makes it easier to remove templates and content slices and reuse them on many pages. the data preview logic should be implemented using dynamic scripting languages, such as JavaScript, beanshell, Jython, or jacl. this makes it easier to modify the user interface on the surface. generally, data reception should be implemented as a service, which can be called from these dynamic action scripts. in this way, function modules are shared and reused on multiple pages and other types of user interfaces. note that you cannot use jpublish when using JSP as a view template, so the Special Action effects cannot be provided. we recommend that you use a single scriptlet to prepare data at the top of each page. in this case, try to call the worker service or the Java method of the worker to exclude the logic from the page as much as possible. 3) view display template freemarker is the best template engine we recommend for HTML and other texts. it is like velocity, but it is more flexible and better suited to OFBiz core framework tools. in addition to using the freemarker template directly, we strongly recommend using jpublish, so that the action can be associated with the page and template, and the page can be rendered by a common template. view display templates should be kept as simple as possible; general content such as headers, footers, and sidebars should be added in real time through rendering mode. the template file used to render each page is defined in the jpublish definition XML file. when you want to display reports like a view, we recommend that you use jasperreports or Datavision In the controller. these reports are installed in the XML file through view-map. if you want to use other text generation tools such as velocity or XSLT, we recommend that you use jpublish to do this, especially if you want it to be rendered or have actions to provide data for these templates. if you use the UI mode that can be repeated frequently, such as forms, request data display, tab or Menu Bars, expanding tree views. we recommend that you use an XML file to describe the UI mode, and then use XSLT to convert it into a freemarker template, which can merge the final template and Context data. note that the recommended ones are often changed and redefined, which shows that there are multiple solutions for different methods. when freemarker is impossible or impractical, we recommend other dynamic template languages such as velocity. If this is also impractical, we recommend JSP. but when we use JSP, we cannot take advantage of the action or rendering template, because you cannot execute it through jpublish. even if you cannot use the rendering mode, you can use the combined view mode with the OFBiz region framework. regions in regions. XML file definition. note that these regions are not as useful as jpublish combination views, and they do not support actions. however, the regions framework provides a lot of flexibility and is useful in many cases.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.