Class PropertiesMap

  • All Implemented Interfaces:
    Map<String,​String>

    public class PropertiesMap
    extends Object
    implements Map<String,​String>
    Bean representing a properties document that holds a map of name/value pairs. In an HST Component, a bean like this can be created with a PropertiesBean object as argument and subsequently set on the request for access in jsp. Example 1:
    
        // get a document named "properties" at same level as current bean
        Properties propertiesDoc = this.getContentBean(request).getParentBean().getBean("properties", Properties.class);
        
        if (propertiesDoc != null) {
            request.setAttribute("properties", new PropertiesMap(new PropertiesBean(propertiesDoc)));
        }   
     
    Example 2:
    
        There is also a Spring instantiated PropertiesManager present with which
        beans can be gotten from content:
    
        ComponentManager componentManager = HstServices.getComponentManager();;
        this.propertiesManager = componentManager.getComponent(PropertiesManager.class.getName());
        
        Map<String, String> properties = new PropertiesMap(this.propertiesManager.getPropertiesBean(this.getSiteContentBaseBean(request)));
     
    Example 3:
    
        There is also a static utility class that creates PropertiesMaps.
    
        Map<String, String> properties = PropertiesUtil.toMap(this.propertiesManager.getPropertiesBean(this.getSiteContentBaseBean(request)));
     
    Because it is a map, access in jsp can be done using direct expression language notation like "labels['label.header']"