|
|
|
Samples SamplesXml Code Config API Docs Download Neolectric |
|
Using ParametersA Parameter is an object that uses a name or key to return a runtime value.The value returned may be text or some other kind of Object. Browsers generally send text while dxp tags may put text Strings or other Java Objects into the request once the page begins to run. There are 3 kinds of parameters in dxp:
1. Request parameters are introduced in request-parameters.html2. Parameter attributes allow you to assign dynamic values to many (but not all) attributesHTML tags can use dynamic attributes that return text values.
<form>
<b>Name:</b> <input type="text" value="${firstname}" size="10"/>
</form>
Most dxp tags require a mix of fixed and dynamic attributes that vary with the tag in question.The dxp:Rp tag can assign the value attribute dynamically but requires a fixed attribute for store
<dxp:Rp value="${firstname}" store="myname"/>
The example above creates a new name/value pair in the request for subsequent tags to find.
If you try to use a RuntimeAttribute with store you will get an error...
<dxp:Rp value="${firstname}" store="${myname}"/>
/dxp/sample/parameter-attributes.dxp: org.xml.sax.SAXException:
unable to create node dxp:Rp at line 28
com.neolectric.dxp.DxpException: This attribute must be a fixed value: store
Unlike Rp, the dxp:Cp (constant parameter) tag requires a fixed value attribute and does not have a store attribute. <dxp:Cp name="myname" value="Mark"/> The JavaDoc page for each dxp class contains an Attribute Summary that tells you what type of attributes the tag will accept. These are located in the API Docs In dxp tags (not html tags) the system creates 3 different classes to assign attributes.
Some tags can use all 3 types interchangeably to get their runtime value. 3. Parameter nodes are child nodes, identified by name, that supply values to a parent
<dxp:SendMail mailserver="mail.yourdomain.com" store="email">
<dxp:Rp name="to" value="${recipient}" require="true"/>
<dxp:Cp name="from" value="sales@yourdomain.com"/>
<dxp:Cp name="replyto" value="blackhole@yourdomain.com"/>
<dxp:Rp name="content" value="${invoice}" require="true"/>
</dxp:SendMail>
The SendMail tag uses Parameter nodes to supply runtime values for email it wants to send. It doesn't care what kind of nodes they are as long as they implement the Parameter interface and return a runtime value when given the current request. In the example above, the Rp (runtime parameter) tags are used to supply dynamic values and the Cp (constant parameter) tags are used to supply fixed values. FootnoteSome dxp tags work standalone to display or process request values, some work as Parameter nodes to supply values for their parents and some can operate in either mode. The Rp tag can operate as a standalone node or a child Parameter node. The Cp tag only does meaningful works as a child Parameter node. |