Class FormSet

  • All Implemented Interfaces:
    Plugin

    public class FormSet
    extends java.lang.Object
    implements Plugin
    FormSet is a companion WikiPlugin for Form.

    The mandatory 'form' parameter specifies which form the variable applies to. Any other parameters are put directly into a FormInfo object that will be available to a Form plugin called 'form' (presumably invoked later on the same WikiPage).

    If the name of a FormSet parameter is the same as the name of a Form plugin input element later on the same page, the Form will consider the given value the default for the form field. (However, the handler for the Form is free to use the value as it wishes, and even override it.)

    If the name of a parameter is not present in Form input fields, the parameter is presumably meant for sending initial information to the Form handler. If this is the case, you may want to specify the populate='' in the Form open element, otherwise the form won't be displayed on the first invocation.

    This object looks for a FormInfo object named FORM_VALUES_CARRIER in the WikiContext. If found, it checks that its name matches the 'form' parameter, and if it does, adds the plugin parameters to the FormInfo. If the names don't match, the old FormInfo is discarded and a new one is created. Only one FormInfo is supported at a time. A practical consequence of this is that a FormSet invocation only applies to the Form plugins that follow it; any further Forms need new FormSet calls.

    See Also:
    FormInfo
    • Constructor Summary

      Constructors 
      Constructor Description
      FormSet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String execute​(Context ctx, java.util.Map<java.lang.String,​java.lang.String> params)
      This is the main entry point for any plugin.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • execute

        public java.lang.String execute​(Context ctx,
                                        java.util.Map<java.lang.String,​java.lang.String> params)
                                 throws PluginException
        This is the main entry point for any plugin. The parameters are parsed, and a special parameter called "_body" signifies the name of the plugin body, i.e. the part of the plugin that is not a parameter of the form "key=value". This has been separated using an empty line.

        Note that it is preferred that the plugin returns XHTML-compliant HTML (i.e. close all tags, use <br /> instead of <br>, etc.

        Specified by:
        execute in interface Plugin
        Parameters:
        ctx - The current WikiContext.
        params - A Map which contains key-value pairs. Any parameter that the user has specified on the wiki page will contain String-String parameters, but it is possible that at some future date, JSPWiki will give you other things that are not Strings.
        Returns:
        HTML, ready to be included into the rendered page.
        Throws:
        PluginException - In case anything goes wrong.