This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

When invoked, a JSPWiki plugin may be given an arbitrary number of "parameters" in the form of key-value pairs.

The showParameters plugin examines its parameter table and lists all parameters that were given in the plugin invocation.


Save the source code shown at the bottom of this page into a file called Then invoke the Java compiler as follows

(or similar - depending on the development environment you are using)


Create a JAR archive containing the Java class file for the plugin. You may use the command

  jar cvf showParameters.jar showParameters.class
for that purpose.

Then move that file into any directory within your wiki's class path - preferrably into the WEB-INF/lib/ folder within your web server's web application directory for the JSPWiki.

Finally restart the Wiki for the plugin to be recognized.


Within wiki markup, invoke the plugin as follows

  [{showParameters literal=singleWord, anotherLiteral="multiple words", number=1234, boolean=true}]
As the class resides in the default directory, there is no need neither to prefix the plugin name with a package path nor to modify the plugin search path within the JSPWiki configuration file.

You may also add any other parameters you like - the only restriction is given by the syntactic constraints imposed by JSPWiki.

The final wiki output should then contain a section like

showParameters - lists the given plugin parameters#

literal (java.lang.String)
anotherLiteral (java.lang.String)
"multiple words"
number (java.lang.String)
"1234 "
boolean (java.lang.String)
Important Note
for some reason (not known to the author), the plugin does not actually list the parameters as foreseen - instead, it mixes up names and values...

Source Code#

import java.util.*;                  // Java utility classes and data structures

import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.plugin.*;

public class showParameters implements WikiPlugin {
  public String execute (WikiContext Context, Map ParameterMap) throws PluginException {
    String Result = "<h4>showParameters - lists the given plugin parameters</h4>\n";

  /**** take care of a missing ParameterMap (may that ever happen?) ****/

    if (ParameterMap == null) {
      return Result + "(no parameters given)";

  /**** otherwise retrieve (and show) any given parameters ****/

    Iterator ParameterInterator = ParameterMap.keySet().iterator();
    if (!ParameterInterator.hasNext()) {                  // this looks probable
      return Result + "(no parameters given)";

    Result += "<dl>";
      while (ParameterInterator.hasNext()) {
        Object Key =;
        Result += "<dt>" + Key + (Key != null ? " (" + Key.getClass().getName() + ")" : "") + "\n";

        Object Value = (Key == null ? null : ParameterMap.get(Key));
        if (Value == null) {
          Result += "<dd>(null)";
        } else {
          if (Value instanceof String) {
            Result += "<dd>\"" + Value + "\"";
          } else {
            Result += "<dd>(" + Value.getClass().getName() + ") " + Value + "\n";
    return Result + "</dl>";

Andreas Rozek (EMail: Andreas.Rozek@GMX.De)

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 09-Apr-2003 16:27 by