Dashboard > RIFE > ... > Web engine > Properties
RIFE Log In | Sign Up   View a printable version of the current page.
Properties


Added by Geert Bevin, last edited by Geert Bevin on May 22, 2004
Labels: 
(None)

When you define elements in the site structure, you can set values for named properties that will only be set for that particular element instance. For example:

<element id="PROPERTIES1" file="element/engine/properties.xml" url="/properties1">

    <property name="property1">property1a</property>
    <property name="property2">property2a</property>
</element>
<element id="PROPERTIES2" file="element/engine/properties.xml" url="/properties2">
    <property name="property1">property1b</property>

    <property name="property3">property3b</property>
</element>

where the element is implemented as follows:

public class Properties extends Element
{
    public void processElement()
    {
        print("Property 1 = "+getProperty("property1"));
        print("Property 2 = "+getProperty("property2"));
        print("Property 3 = "+getProperty("property3"));
    }
}

When you visit the "/properties1" URL, the output will be:

Property 1 = property1a
Property 2 = property2a
Property 3 = nul

and for the "/properties2" URL, the output will be:

Property 1 = property1b
Property 2 = null
Property 3 = property3b

This is currently really a "poor-man's" version of IoC where only literal values can be injected. In a later version we are planning to extend this to a much more flexible system.



Are you enjoying Confluence? Please consider purchasing it today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.1a Build:#515 May 19, 2006) - Bug/feature request - Contact Administrators