Variable evaluation order#

The variables are evaluated in the following order:
  1. 'Preset' variables (or constants), as those listed on this page.
  2. 'Context' variables, as those set by plugins and tags.
  3. 'Property' variables, like those set in jspwiki.properties.
  4. 'Page' variables, like those set using the "SET" directive.


WikiVariables are variables that are evaluated when a page is viewed.

The two types of WikiVariables are defined below.

Page Variables#

Starting with JSPWiki 2.2, you can use the "SET" directive to define a variable that exists only in the page.
You can access this value anywhere on your page by using the shorthand "[{$foo}]".


Page Variables are effective when set in anyplace on the page regardless of the order. Setting a Page Variables at the bottom of the page implies it will work anyplace on the page.

Accessing Page WikiVariables "[{$test}]" before it is set:
test = No such variable: No variable test defined.

Then setting 'foo' to 'bar' For example:

  [{SET foo='bar'}]
creates you a variable called "foo", which has the value of "bar".

Accessing "[{$foo}]" After it is set:
foo = bar

Pre-defined Variables#

applicationnameThis is the name of this Wiki. It has been set by the administrator in "jspwiki.properties".Ldapwiki[{$applicationname}]
baseurlThe base URL address for this wikihttp://ldapwiki.com/[{$baseurl}]
encodingDescribes the character encoding used in this Wiki. An encoding of "UTF-8" means that the Wiki accepts any character, including Chinese, Japanese, etc. Encoding "ISO-8859-1" means that only western languages are supported.UTF-8'[{$encoding}]
inlinedimagesLets you know which image types are able to be inlinedhttps://ldapwiki.com/images/*, *.png, *.jpg[{$inlinedimages}]
interwikilinksWrites HTML code for supported InterWiki linksWikiWikiWeb --> http://c2.com/cgi/wiki?%s, JSPWiki --> http://jspwiki-wiki.apache.org/Wiki.jsp?page=%s, Doc --> http://jspwiki-wiki.apache.org/Wiki.jsp?page=%s, TWiki --> http://twiki.org/cgi-bin/view/TWiki/%s, Wikipedia --> http://www.wikipedia.com/wiki/%s, Google --> http://www.google.com/search?q=%s, RFC --> https://tools.ietf.org/html/rfc%s, MeatballWiki --> http://usemod.com/cgi-bin/mb.pl?%s, Edit --> Edit.jsp?page=%s[{$interwikilinks}]
jspwikiversionInserts the version number of the JSPWiki engine.2.10.1[{$jspwikiversion}]
loginstatusShows the status of the current logged-in useranonymous[{$loginstatus}]
uptimeInserts the amount of time since this Wiki has been last restarted0d, 14h 8m 59s[{$uptime}]
pagenameInserts the current page name.WikiVariables[{$pagename}]
pageproviderThe current PageProviderorg.apache.wiki.providers.VersioningFileProvider[{$pageprovider}]
pageproviderdescriptionA verbose, HTML description about the currently used page provider[{$pageproviderdescription}]
requestcontextThe current RequestContextview[{$requestcontext}]
totalpagesThe total number of pages available in this Wiki16390[{$totalpages}]
usernameInserts the current user name3.236.50.79[{$username}]
inlinedimagesInlined images on Ldapwikihttps://ldapwiki.com/images/*, *.png, *.jpg[{$inlinedimages}]
pagefiltersInstalled PageFilters[{$pagefilters}]

Inserting JSPWiki properties#

You can also access some of the JSPWiki properties (that have been defined by the site maintainer) by using their property names directly. See SystemInfo for an example. Note that some properties might not be accessible due to security reasons.

You can also obtain some data from the JSPWiki Plugins.

Needs more info on how to set global variables in jspwiki.properties. I cannot find how anywhere..



More Information#

There might be more information for this subject on one of the following: