Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Eclipse

...

  • Events are used for validation and conversion using map processor, while services are used for business logic like CRUD operation
  • Service returns Map
  • Event returns String.
  • Services are loaded with the server, any changes in definition (not implementation if in MiniLang) needs a reload
  • We can call service inside event. But we cannot call event inside service.
  • An event is specific local piece functionality normally used in one place for one purpose and called from its location.
  • A service is a piece of functionality which can be located anywhere on the network, is most of time used in several different places and is called by its 'name'
  • In case of events you have access to HttpServletRequest and HttpServletResponse objects and you can read/write whatever you want. In case of services, you have access only to service parameters.

Anchor
HowToChangeTheDefaultMessages
HowToChangeTheDefaultMessages

How to change the default messages

The messages that come in different pages in OFBiz are configured using several configuration files. The best parts of message display framework under OFBiz are as follows:

  1. It is totally internationalized.
  2. Actual text messages are stored in configuration files only. This configuration files are written in XML using property key value approach. The actual files like FTL files, service definition files which use these text messages refers to the property key and locale (optional) only to display the message in the output page.
  3. You can hide the message by just clicking on it. No reloading is required.

The main components of the message display framework in OFBiz are

  1. messages.ftl: under ofbiz/framework/common/webcommon/includes folder. It is responsible for displaying error and event message in a specific div on the top of the content area.
  2. CommonUiLabels.xml: under ofbiz/framework/common/config folder. This is a property key value configuration file for storing common UI label elements including error / event headers and messages.
  3. CommonErrorUiLabels.xml: under ofbiz/framework/common/config folder. This is a property key value configuration file for storing common error message elements.

Beside these two configuration files there are at least one property key value configuration file under the config directory of the respective element for almost all elements like accounting, manufacturing, service, minilang etc. under the applications and framework directories. e.g. AccountingErrorUiLabels.xml, MiniLangErrorUiLabels.xml, ServiceErrorUiLabels.xml

One important thing to notice here is that all UI labels in OFBiz are displayed in the same manner using the property key value XML configuration files available under the config directory. In some cases there are no separate error configuration files but the error messages are included in the UI label configuration file itself. e.g. in case of marketing component related error messages are included in the MarketingUiLabels.xml under ofbiz/applications/marketing/config folder.

How to change a specific error message

  1. First identify the module in which the message is coming.
  2. If it is a common message then it would be in CommonUiLabels.xml or in CommonErrorUiLabels.xml
  3. If it is a module specific message then look into the configuration files under the config folder of that component.
  4. Identity the key and change the value in English language. If you presently want to change the English message only, then there is no need to do to anything else. However, if you want to update the internationalization part also then you need to do the following step for each language.
    • Now using a specific translation program like Google Language Tools, translate the English sentence into a specific language and copy paste that in the value for that specific language.
    • After the change is over you need to restart the server for the changes to take effect.

The same procedure can be followed for changing the UI label elements.

A tip from Amitava Neogi