Marco Napolitano

Passionate and addicted to technology

Cookies help us deliver our services.

By using our services, you agree to our use of cookies. Learn more

I understand

How to implement a custom Gogo shell command for Liferay 7

Liferay DXP (and its free counterpart Liferay 7) introduced many new features, first of all the OSGi integration. Among the many new tools provided there is a shell to interact with the OSGi container; I'm talking about Gogo shell (a subproject of Apache Felix) accessible with the command telnet localhost 11311.

Once accessed to the shell, we can see the list of all available commands simply by typing help; each command is formed by a scope (a kind of grouping) and a name.

So let's see how to create a custom command to be executed inside the Gogo shell.

Read more: How to implement a custom Gogo shell command for Liferay 7

How to use Liferay AutoFields

AutoFields is an AlloyUI component which can be used inside a form to dynamically add multiple elements.

Liferay uses it in many points: have you ever tried to enter a phone number or an address into your user profile? Have you noticed the + and - buttons? By pressing these buttons whole portions of HTML are added (or removed) to the form, allowing you to add multiple items; and all is integrated with the history management.

So let's see how to use this component in a custom plugin.

Read more: How to use Liferay AutoFields

Create a reusable AlloyUI custom validator

The AlloyUI framework integrated within Liferay provides a very powerful and flexible system for the form validation: some default validators (required, url, email, ...) are provided and you can also create custom validators with your personal application logic.

But if you want to re-use many times the same custom validator, you need to duplicate code around the application; so let's see a very interesting way to define a reusable custom validator.

Read more: Create a reusable AlloyUI custom validator