Legacy Knowledge Base
Published Sep. 10, 2025

Adding custom preferences to Spring MVC Portlet

Written By

Antonio Ortega

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • We've create a new Spring MVC Portlet and we'd like to configure it with some custom portlet preference. How can we do it?

Environment

  • Liferay DXP

Resolution

Once you've created your Spring MVC Portlet you need to follow below steps in order to add some custom preferences to it:

  • Create a configuration.jsp file. You can add some sample content like: <h1>Test Config</h1>. Modify portlet.xml file to indicate where that config file is and mark it as config-template, it is to say, adding to your portlet.xml something like:
 <init-param>
<name>config-template</name>
<value>/configuration.jsp</value>
</init-param>
  • Modify your liferay-portlet.xml adding the required configuration-action-class as it is explained in the section Creating a Default Setup Tab in the Portlet’s Configuration Page. For a proof of concept you can just use the class DefaultConfigurationAction provided by Liferay. In other case, you need to create your custom configuration action class extending that one.
  • After that, you can build and deploy your portlet, and once you click on configuration option you'll be able to see the title "Test Config".
  • Once you are in that point, we recommend you to read those two articles we linked below and have a look at this Configuration Action Blade Sample to see how you can continue in case you need further help.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base