ContentsWeb Page DesignUsing Java Commands
Previous: Setting New Variables | Next: Java Class Design

Using Java Commands

The set command is written in Java, so you have already seen how to use Java commands.  There are a few more things that bear mentioning, though.

Joining results

A very useful command is join - which takes two parameters: a list of strings and a string to join them with.  Often the list of strings will be output from another command.  A command that results in a list of values, for example, can be joined with <tr><td> to define a table row.  The same list could be joined with <li> to make list items, or with <option> to make a selection list for a form.

A good simple example of this is to get a list of all WELD commands.  To do this, make a WELD file that looks something like this:

  <html><head><title>[set pagetitle "WELD commands"]</title></head>
  <body><center><h1>$pagetitle</h1>
  <table border=3><tr><td>[join [lsort [info commands]] <tr><td>]</table>
  </body></html>

The nested commands may need a little explanation.  As with other forms of nesting, command nesting should be read from the inside out instead of left-to-right.  Here, the "info" Java command takes "commands" as it's only parameter and returns a list of valid commands.  This list of commands is sorted by lsort (which means "list sort") and then joined with join.


ContentsWeb Page DesignUsing Java Commands
Previous: Setting New Variables | Next: Java Class Design

Modified: Tue Apr 18 15:49:05 EDT 2000