[xwiki-users] simple declare a list in velocity
hello this is by far the most easiest thing ... but i have some data that i want to simple add in a list #set($dateList = new ArrayList() ) $dateList.add($dateD) whyyy is this wrong? how do i else declare a list ? cause it does not work thank you -- View this message in context: http://n2.nabble.com/simple-declare-a-list-in-velocity-tp4104854p4104854.htm... Sent from the XWiki- Users mailing list archive at Nabble.com.
In velocity you don't have the keywork *new*. You should use the variable $util to declare a list. #set($dateList = $util.arrayList) $dateList.add($dateD) And on operations with lists you use $listttool. $listtool.size($dateList) Best regards, Flavius Olaru On Thu, Dec 3, 2009 at 10:50 AM, Bubulina <[email protected]> wrote:
hello this is by far the most easiest thing ... but i have some data that i want to simple add in a list #set($dateList = new ArrayList() ) $dateList.add($dateD)
whyyy is this wrong? how do i else declare a list ? cause it does not work thank you -- View this message in context: http://n2.nabble.com/simple-declare-a-list-in-velocity-tp4104854p4104854.htm... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
To add some information to this. The reason why there is no direct way to create a object from velocity is for security reasons. So we provide util functions for creating java objects we have audited to be secure (not allow to access physical resources or xwiki data without rights checks for instance) For when you really need more users with programming rights can create a groovy class which is callable from velocity Ludovic Ludovic Envoyé de mon iPhone Le 3 déc. 2009 à 10:02, Flavius Olaru <[email protected]> a écrit :
In velocity you don't have the keywork *new*. You should use the variable $util to declare a list.
#set($dateList = $util.arrayList) $dateList.add($dateD)
And on operations with lists you use $listttool. $listtool.size($dateList)
Best regards, Flavius Olaru
On Thu, Dec 3, 2009 at 10:50 AM, Bubulina <[email protected]> wrote:
hello this is by far the most easiest thing ... but i have some data that i want to simple add in a list #set($dateList = new ArrayList() ) $dateList.add($dateD)
whyyy is this wrong? how do i else declare a list ? cause it does not work thank you -- View this message in context: http://n2.nabble.com/simple-declare-a-list-in-velocity-tp4104854p4104854.htm... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On Dec 3, 2009, at 10:02 AM, Flavius Olaru wrote:
In velocity you don't have the keywork *new*. You should use the variable $util to declare a list.
$util is deprecated and yes indeed you should use the $listtool. Doc is here: http://velocity.apache.org/tools/releases/1.4/javadoc/org/apache/velocity/to... To creare a list in velocity: #set ($myvar = []) Thanks -Vincent
#set($dateList = $util.arrayList) $dateList.add($dateD)
And on operations with lists you use $listttool. $listtool.size($dateList)
Best regards, Flavius Olaru
On Thu, Dec 3, 2009 at 10:50 AM, Bubulina <[email protected]> wrote:
hello this is by far the most easiest thing ... but i have some data that i want to simple add in a list #set($dateList = new ArrayList() ) $dateList.add($dateD)
whyyy is this wrong? how do i else declare a list ? cause it does not work thank you -- View this message in context: http://n2.nabble.com/simple-declare-a-list-in-velocity-tp4104854p4104854.htm... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On Dec 3, 2009, at 10:20 AM, Ludovic Dubost wrote:
To add some information to this. The reason why there is no direct way to create a object from velocity is for security reasons. So we provide util functions for creating java objects we have audited to be secure (not allow to access physical resources or xwiki data without rights checks for instance)
For when you really need more users with programming rights can create a groovy class which is callable from velocity
Groovy or Ruby or Python. See http://code.xwiki.org/xwiki/bin/view/Macros/GroovyMacro http://code.xwiki.org/xwiki/bin/view/Macros/PythonMacro http://code.xwiki.org/xwiki/bin/view/Macros/RubyMacro Thanks -Vincent
Ludovic
Envoyé de mon iPhone
Le 3 déc. 2009 à 10:02, Flavius Olaru <[email protected]> a écrit :
In velocity you don't have the keywork *new*. You should use the variable $util to declare a list.
#set($dateList = $util.arrayList) $dateList.add($dateD)
And on operations with lists you use $listttool. $listtool.size($dateList)
Best regards, Flavius Olaru
On Thu, Dec 3, 2009 at 10:50 AM, Bubulina <[email protected]> wrote:
hello this is by far the most easiest thing ... but i have some data that i want to simple add in a list #set($dateList = new ArrayList() ) $dateList.add($dateD)
whyyy is this wrong? how do i else declare a list ? cause it does not work thank you
On Thu, Dec 3, 2009 at 10:41, Vincent Massol <[email protected]> wrote:
On Dec 3, 2009, at 10:20 AM, Ludovic Dubost wrote:
To add some information to this. The reason why there is no direct way to create a object from velocity is for security reasons. So we provide util functions for creating java objects we have audited to be secure (not allow to access physical resources or xwiki data without rights checks for instance)
For when you really need more users with programming rights can create a groovy class which is callable from velocity
Groovy or Ruby or Python.
See http://code.xwiki.org/xwiki/bin/view/Macros/GroovyMacro http://code.xwiki.org/xwiki/bin/view/Macros/PythonMacro http://code.xwiki.org/xwiki/bin/view/Macros/RubyMacro
Or PHP ;) http://code.xwiki.org/xwiki/bin/view/Macros/PHPMacro
Thanks -Vincent
Ludovic
Envoyé de mon iPhone
Le 3 déc. 2009 à 10:02, Flavius Olaru <[email protected]> a écrit :
In velocity you don't have the keywork *new*. You should use the variable $util to declare a list.
#set($dateList = $util.arrayList) $dateList.add($dateD)
And on operations with lists you use $listttool. $listtool.size($dateList)
Best regards, Flavius Olaru
On Thu, Dec 3, 2009 at 10:50 AM, Bubulina <[email protected]> wrote:
hello this is by far the most easiest thing ... but i have some data that i want to simple add in a list #set($dateList = new ArrayList() ) $dateList.add($dateD)
whyyy is this wrong? how do i else declare a list ? cause it does not work thank you
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
Hello, So only by using the tools i can use lists and sort right? this code should work: $dateList.add($date) //it populates $sorter.sort($dateList,["${date}:asc"]) //does not sort ##Collections.sort($dateList) vmassol wrote:
On Dec 3, 2009, at 10:02 AM, Flavius Olaru wrote:
In velocity you don't have the keywork *new*. You should use the variable $util to declare a list.
$util is deprecated and yes indeed you should use the $listtool. Doc is here: http://velocity.apache.org/tools/releases/1.4/javadoc/org/apache/velocity/to...
To creare a list in velocity:
#set ($myvar = [])
Thanks -Vincent
#set($dateList = $util.arrayList) $dateList.add($dateD)
And on operations with lists you use $listttool. $listtool.size($dateList)
Best regards, Flavius Olaru
On Thu, Dec 3, 2009 at 10:50 AM, Bubulina <[email protected]> wrote:
hello this is by far the most easiest thing ... but i have some data that i want to simple add in a list #set($dateList = new ArrayList() ) $dateList.add($dateD)
whyyy is this wrong? how do i else declare a list ? cause it does not work thank you -- View this message in context: http://n2.nabble.com/simple-declare-a-list-in-velocity-tp4104854p4104854.htm... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- View this message in context: http://n2.nabble.com/simple-declare-a-list-in-velocity-tp4104854p4105961.htm... Sent from the XWiki- Users mailing list archive at Nabble.com.
participants (5)
-
Bubulina -
Flavius Olaru -
Ludovic Dubost -
Thomas Mortagne -
Vincent Massol