You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Macro descriptionMake Confluence pages dynamic, with content depending on user input, with a simple HTTP parameter macro.
What it looks like 

 

 

## @param param:title=Parameter|type=string|required=true|desc=URL Parameter to capture
## @param default:title=Default Value|type=string|required=false|desc=Number value if no param is set.
## @param adjust:title=Numeric Adjustment|type=int|required=false|desc=Amount to increase or decrease (if negative) param value by.
## Consider blank equal to non-existent.
#if($req.getParameter($paramparam) && $req.getParameter($paramparam)!='')
#set(  $p=$req.getParameter($paramparam))
#if(  $stringUtils.isNumeric($p))
#if(    $paramadjust)
#set(      $adjustVal=0)
#set(      $adjustVal=$adjustVal.parseInt($paramadjust))
#set(      $modVal=0)
#set(      $modVal=$modVal.parseInt($p))
#set(      $p=$modVal+$adjustVal)
#end
$!p
#else
Error: Parameter $paramparam is not a number.
#end
#else
$!paramdefault
#end
  • No labels