OFBiz Tutorial – Using CMS for Front End Application Static Pages (Part-1‏)

Pranay PandeyPublished: Updated:

In this post, I’ll demonstrate OFBiz CMS(Content Management System) uses for static pages on a website(front end application) through simple content data setup. CMS gives users the flexibility to change the content to be shown on static pages of your website.

Often website owners want to have static web page setup e.g. About Us, FAQ, Terms and Conditions, Privacy Policy etc.  An effective CMS empowers the website owner to update the page content herself, without asking for help from the development team. Let’s walk through a basic example setup of this capability in Apache OFBiz.

All the features mentioned here are supported by the out-of-the-box (OOTB) OFBiz CMS implementation.

In this exercise you will:

  • see the basic concept of DataResource and Content.
  • setup content data to embed FTL markup.
  • setup a content driven screen and use it to show the static content setup through data.

• Assumption: a component is already setup; here we are using the component name as “cmsdemo”.

DataResource and Content records

Let’s suppose that you want to define content (that will be included in a screen) for showing the text “This is the text that will appear on the screen.”.

Data Resource type- ELECTRONIC_TEXT

First of all, you have to define a DataResource representing this text. This gives you greater flexibility because you can store long texts in the textData field. If you want to embed FTL markup (directives etc…) that needs to be processed before rendering, you can achieve this using the dataTemplateTypeId attribute. This way all the Freemarker instructions in the text will be executed before rendering the screen. Following data needs to be setup in an XML data file:


Now you have to create a Content record that is associated to the DataResource. 
No matter what type of data resource you have chosen, the Content record is the same as:

Note that the contentTypeId is “DOCUMENT”: all pages and sections of pages should be of this type.

Using the <content/> element in a screen definition

Now we can easily include the content directly inside the <widgets/> section of the screen definition with the following directive:

In the given example screen name is “main”.

Running the content driven screen

Load the data that you have just created for static content for a screen.

Make sure to have an entry in ofbiz-component.xml file for the data file created as:

or if OFBiz is already up on your machine then you can also load data through webtools –> XML Data Import.

Request and View Mapping in Controller.xml

Now access the main page by using URL: [https://localhost:8443/cmsdemo/control/main] You will see the result in the browser as follows:

OFBiz CMS Demo

OFBiz CMS Demo

You are done with the basic setup of a static website using OFBiz CMS capabilities.

It was a very basic example.  We’ll expand on the details and demonstrate more OFBiz CMS capabilities in upcoming posts.  If you need help with OFBiz CMS in the mean time please feel free to contact HotWax Systems today!


Pranay Pandey About Pranay Pandey
Pranay Pandey has been in the software industry since 2006. He specializes in Enterprise Software Design and Development. At HotWax he currently leads the effort of architecting quality software products and training resources. He continues to be dedicated to the Apache OFBiz open source project since 2007 and became a committer in 2014. He leads our internal training programs in Apache OFBiz, ERP and new technologies under the roof of HotWax University. He is an Electronics graduate and has a masters degree in Computer Applications from Rajeev Gandhi Technical University, Bhopal (M.P.) India. He loves learning and sharing knowledge. He believes that one of the keys to success in this industry is to "keep learning". His hobbies are reading, writing, walking, running, cycling, cooking and watching science fiction movies.

Comments 2

  1. Avatar for Pranay Pandey

    Please Provide Videos If any regarding this Tutorial( Using CMS for Front End Application Static Pages (Part-1‏))

    1. Avatar for Pranay Pandey Post

Leave a Reply

Your email address will not be published. Required fields are marked *