Plands.com Logo  Business Internet Services 
Main Menu
Home
Planetary CRM
  Benefits
  Features
  Demo
E-Mail Services
  E-mail Hosting
  Newsletters
  Discussion Lists
Web Hosting
Server Co-location
and Administration
Web Applications
Technical Support
Contact Us
DXP Samples
 
DxpHome  ||   Samples  ||   Details  ||   Docs  ||   Trees  ||   xml-xsl  ||   Links
// Tokens.java

The Tokens tag is used to concat parameter values into a single value or separate them into new values based in a delmiter char in the input value. The action attribute controls the behavior with "concat" or "separate".

The tag can use Parameter or ArrayParamter tags as input to supply the values. The default delimiter is comma but other delimiters can be specified including delim=" " for breaking a value into tokens at space chars and delim="" for combining values together without a delimiter.

In this example the runtime Parameter values of Rp tags are combined into a comma delimited list and stored as a new parameter called "to".

<dxp:Tokens action="concat" store="to">
   <dxp:Rp name="yourEmailAddrs" />
   <dxp:Rp name="otherEmailAddrs" />
</dxp:Tokens>

The Tokens tag implements the Parameter interface so it can create a list and pass it directly to a parent that uses Parameter tags.

<dxp:SendMail mailserver="mail.yourdomain.com">
   <dxp:Tokens action="concat" name="to">
      <dxp:Rp name="yourEmailAddrs" />
      <dxp:Rp name="otherEmailAddrs" />
   </dxp:Tokens>
     ... other parameters follow...
</dxp:SendMail>
 
  

In this example an array of values is returned by an Ap tag. The Tokens tag will combine them into a String with a space between each value.

<dxp:Tokens action="concat" delim=" " store="choices">
   <dxp:Ap name="checkboxes"/>
</dxp:Tokens>

The Tokens tag can also be used to separate values from a delimited String and store them under new parameter names. Suppose a webform contained a select list called userinfo that posted an option value as "username.ID". This is a handy way of incorporating two fields of info into one option. A Tokens tag on the receiving page can be used to break the option values apart and store them back into the request as two separate parameters.

<dxp:Tokens action="separate" delim="." store="username,ID">
   <dxp:Rp name="userinfo" require="true"/>
</dxp:Tokens>


@author Mark Ashworth
@version 0.2, 2001-06-08

Return to Index

Note: We have tried to test all of the code examples but they may contain errors. Any questions, comments, suggestions, or problems should be sent to info@plands.com.