How do I pass a parameter through the applet tag to the configuration?
I have the following line in my config file:
<action name="moreInfo"
type="gotoUrl"
label="View Details"
url="${details@url}?ID=${data['ID']}"
target="_blank" />
And the following line in my HTML file when setting up the applet:
<param name="details@url"
value="http://mycompany.com/GetDetails.aspx">
However, when I click on the "View Details" link in my applet it can't
seem to find the "details@url" variable and the text "null" appears in the
URL in place of the URL that should be there. Am I doing something
wrong?
Do you have the "applet.config@paths" parameter set in the applet?
This is an optimization parameter that tells the configuration which
properties you are passing through using the PARAM element (excluding the
"config@files" and "config.schema@files", which are actually handled in the
applet itself instead of the configuration code). If you remove this parameter
entirely, the configuration will check the applet for an override value for
every configuration property it loads; otherwise it only checks for properties
starting with the strings in this list (which is comma-separated).
Normally this parameter is set to an empty string, which means no overrides
are occuring in the applet; this helps to speed up configuration and load time.
If you do have this parameter under your applet tag, switch it to:
<param name="applet.config@paths" value="details" />
This should allow all parameters beginning with the string "details". If
you wanted to allow multiple parameters, you could use:
<param name="applet.config@paths"
value="details,config.treemap.dataModel" />
This would allow both the variables "details@url" and
"config.treemap.dataModel.parser@dataSource", but the parameter
"config.treemap.sizeModel@inverted" would not work.
Implementation Note
When passing variables into the configuration, be sure to use the attribute
syntax ("details@url") and not the element syntax ("details.url"); The latter is
the path to an XML element and represents a complex object, while the former is the
path to an attribute on an XML element and represents a simple property. Translated
into XML, the difference (and the reason why 'details.url' doesn't work) becomes
clearer:
details.url details@url
<details> <details url="some url" />
<url />
</details>
'details.url' doesn't refer to anything that can be assigned a value. Internally,
however, our configuration system will try to construct an object for 'details.url'.
However, this fails, so a null is returned. If you open your Java console, you'll
see the following error message:
WARNING: The property at 'details.url' encountered the following
problem: Cannot construct class. Class name not defined in schema.
Basically, even though the configuration is being passed through applet parameters,
the property names still have to respect the rules of the modified XPath syntax we use.
|