From blogs to case studies to news, we love sharing our tips and tricks for asset management, cloud, IoT and smarter operations.

by | Sep 13, 2021

Custom servlet in Maximo

What is a servlet?

Servlets are Java classes which service HTTP requests and implement the ‘javax. servlet. HttpServlet’, an abstract class that implements the servlet interface and is specially designed to handle HTTP requests.

A  servlet accepts the request, processes it, creates a data package, and serves it as response.

Processing usually includes access to databases, fetching data and conversion to object models of convenience. Objects can be JSON, XML, reports, or files exported to a hard disk.

Examples of custom servlets in Maximo are showing images, print attachments, print BIRT reports, export integration files, REST integration, REST token authentication or print various other documents.

 A custom servlet usage scenario

To demonstrate the use of a custom servlet, I will show an example of its use in Maximo.

First, let us imagine a scenario where this servlet will be used:

As a part of RFQ process, a user wants to export quotation lines into a file and send it to the vendor. The user wants to minimize possibilities of error while populating data.

For that purpose, we will create an excel file with extra twists. This includes:

  • vendor specific passwords on the excel sheet,
  • some fields set as read only,
  • fields set as calculated, and
  • fields that have domains in Maximo which will have attached drop down lists with domain values.

This way, vendors only have to populate editable fields quantity and unit cost.

The user wants the action to be triggered at a certain point, through a download button or as a part of the WF process.

How is a custom servlet implemented?

In RFQAppBean we will create an event/method that looks like this:

At some point, while in RFQ application, with relevant RFQ displayed, ‘download event’ will be triggered.

The event will store RfqNum in session and invoke a servlet.

The second step is to define the servlet in web.xml.

Lines to be added are:

The final step is to create a custom class for the servlet. A custom class would look like this:

We are using HSSF (or XSSF) excel library to create an excel workbook from scratch. Creation logic is encapsulated within class ‘RFQLinesDownload()’.

Eventually, the workbook will be streamed to a response. As you can see the output will be a real excel file (not csv).

This is just one example of custom servlet usage among many possibilities. Implementing functionality is relatively easy. There are many ways to use it and they are limited only by your (and your client’s) imagination.


And at the end, here are some bonus excerpts from the ‘RFQLinesDownload()’ class:

How to put a password on excel sheets:

How to create a calculated field:

Finally, click here if you would like to learn more about Maximo in one of my previous blog posts ‘Maximo and Attachments’.

If you would like to learn more about features of Maximo that BPD Zenith can offer, you can contact us at:

Velibor Djukic

Velibor Djukic

Velibor has been working with Maximo for more than 13 years in Middle East and Australia. He had been working as Team Lead on large scale Maximo project such as KOC (Kuwait Oil Company). He spent last couple of years in Mobile space working with Anywhere, EZMax, and Datasplice. Currently works as Solution Architect for BPD Zenith Australia and like to share knowledge with everybody who seeks it.


Submit a Comment

Your email address will not be published.

BPD in Offshore: When the wind blows, our assets perform…

BPD in Offshore: When the wind blows, our assets perform…

London Array Limited (LAL) maintain a critical electricity production wind farm in the Outer Thames Estuary.   Lucy Horner (then Maintenance Strategy Engineer) joined the AiTalks podcast last year to discuss her world of offshore wind provision, the levels of...

Happy International Woman’s Day 2022 – Woman in Tech

Happy International Woman’s Day 2022 – Woman in Tech

International Woman’s day, which is celebrated globally on the 8th of March, commemorates the cultural, socioeconomic and political achievements of woman across the globe with a strong focus on gender equality, and on preventing violence and abuse against woman. The...

Meet the Team – Sourabh Jain

Meet the Team – Sourabh Jain

1. What is your position at BPD Zenith? My name is Sourabh and I’m currently a Senior Maximo Consultant at BPD Zenith, Sydney. 2. What led you to choose this career path? What alternative career path would you have chosen and why? When I was studying programming for...

Sign up to our free newsletter to explore emerging technologies, industry events and Maximo best practice.

Come with BPD Zenith to the future of Asset Management

Partner Ecosystem

BPD Zenith partners with a diverse array of the world’s top Technology, Business and Solution Integration leaders.