This plugin brings the power of Kanaputs language into JSPWiki.
Basically Kanaputs is a way to do java coding without compilation (it intensively uses java introspection).
http://www.kanaputs.fr
Kanaputs in sourceforge

You just need to add 'jspwiki.plugin.searchPath = kanaputs.jspwiki' in your jspwiki.properties and put Kanaputs.jar in attachment inside the lib directory of your wiki.



make a simple sum
[{ Kanaputs printInput='false'

1+2+4+7+14;
}]
28



java method invocation
[{ Kanaputs printInput='false'

Math.PI
}]
3.141592653589793



use variable assignment and java method invocation
[{ Kanaputs printInput='false'

a = 1+2+4+7+14;
b = Math.sqrt(a);
}]
5.291502622129181



example of 'while' loop execution
[{ Kanaputs printInput='false'

v = Vector();
v.add("hello");
v.add(" ");
v.add("world");
out = "";
i = 0;
while(i < v.size()) {
  out = out + v.elementAt(i);
  i = i + 1;
}
out;
}]
hello world



example of Kanaputs reactivity feature
[{ Kanaputs printInput='false'

a = "the length of this string is 31";
b = a.length();
b.reactive = true;
a = a - " is 31";
b;
}]
25



example of local shell invocation (on server side of course)
[{ Kanaputs printInput='false'

#shell ipconfig
}]
Configuration IP de Windows Carte Ethernet Connexion au réseau local: Statut du média . . . . . . . . . : Média déconnecté Carte Ethernet Connexion réseau sans fil: Statut du média . . . . . . . . . : Média déconnecté



using wiki form inputs for a Kanaputs computation
[{ FormSet form='kanaputsTest1' printInput='false' extraParam='5' debug='false'

sum = param1 + param2 + param3 + param4 ;
"param1 = " + param1 + "\\" +
"param2 = " + param2 + "\\" +
"param3 = " + param3 + "\\" +
"param4 = " + param4 + "\\" +
"sum = __" + sum + "__, average = __" + (sum/4) + "__, extra param = " + extraParam ;
}]
[{ FormOpen form='kanaputsTest1' }]
parameter 1&nbsp;&nbsp;&nbsp;[{ FormInput type='text' name='param1' value='1'}]\\
parameter 2&nbsp;&nbsp;&nbsp;[{ FormInput type='text' name='param2' value='2'}]\\
parameter 3&nbsp;&nbsp;&nbsp;[{ FormInput type='text' name='param3' value='3'}]\\
parameter 4&nbsp;&nbsp;&nbsp;[{ FormInput type='text' name='param4' value='4'}]\\
[{ FormInput type='submit' name='submit' value='Submit'}]
\\
\\
[{ FormOutput form='kanaputsTest1' handler='Kanaputs' populate='handler'}]
[{ FormClose }]
parameter 1   
parameter 2   
parameter 3   
parameter 4   


param1 = 1
param2 = 2
param3 = 3
param4 = 4
sum = 10, average = 2.5, extra param = 5

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
jar
Kanaputs.jar 255.2 kB 2 28-Jan-2009 20:35 DuvergerP
« This page (revision-3) was last changed on 22-Apr-2009 10:17 by DuvergerP