No-reload form submission with Objectos Way

Marcio EndoMarcio EndoDec 1, 2024

I have released Objectos PetClinic v002. It introduces a first iteration for a "It should be possible to create new owner record" use-case. In this blog post I want to discuss how to do form submissions in an Objectos Way application. In particular:

  • handle multiple HTTP methods within the same route;

  • no-reload and no-redirect form submission and response; and

  • no Javascript fallback.

Let's begin.

Binding UI actions to HTML buttons

Objectos Way allows you to create dynamic web applications using pure Java. In other words, you don't write any JavaScript nor TypeScript code; you only write Java code. Off course JavaScript will still be running in the browser.

To support a "create a new owner record" use-case in a dynamic web application you might want:

  • clicking on a "Add owner" button should show a form in a modal;

  • clicking outside the modal should hide the modal;

  • clicking in the modal itself should not hide the modal; and

  • clicking in a "Cancel" button should hide the modal.

Here's a video:

Here's a high level view of how it is implemented.