Configuring Portlet Template Parameter State Properties

Portlet template parameters are added automatically as state properties to the view component’s STATE object. Therefore, you can provide additional configuration options for them in the STATE object. The example below sets the default value for the portlet template parameter color in its *MVCRenderCommand class:

Template template = (Template)renderRequest.getAttribute(
String color = "red";

template.put("color", color);

The configuration above has the implicit state property configuration shown below in the view’s component file ( for example):

   View.STATE {
     color: {
       value: 'red'

You can provide additional settings by configuring the state Property in the View component. The example below defines a setter function that transforms the color’s string to upper case before adding it to the STATE object:

function setColor(color) {
  return color.toUpperCase();

View.STATE = {
  color: {
    setter: 'setColor'      

Now you know how to configure portlet template parameter state properties!

Understanding the State Object’s Architecture

Configuring Soy Portlet Template Parameters on the Client Side

« Understanding The State Object's ArchitectureConfiguring Soy Portlet Template Parameters on the Client Side »
Was this article helpful?
0 out of 0 found this helpful