Implementing the Plugin Class
Here is the code of an example plugin that receives one optional parameter name (which defaults to "World"), and renders some welcome text based on this:
package com.intland.codebeamer.wiki.plugins;
import java.util.Map;
import com.ecyrd.jspwiki.WikiContext;
import com.intland.codebeamer.wiki.plugins.base.AbstractCodeBeamerWikiPlugin;
public class HelloWorldDemoPlugin extends AbstractCodeBeamerWikiPlugin {
public String execute(WikiContext context, Map params) {
String name = (String)params.get("name");
if(name == null) {
name = "World";
}
return "Hello " + name + "!";
}
}
Implement the
execute method that returns the
String that will get rendered into the final HTML output. The argument
context carries state information about the current wiki rendering process, while
params is a named map of parameters that are passed from the markup.
For more information, see the
JSPWiki javadocs and the source code of various
JSPWiki plugins.