cristian.vrabie(a)xwiki.com wrote:
Hi,
What you're looking for is the createNewObject method in Document Api.
Here's a link to javadoc:
http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.…
So you can do:
#set( $objnr = $doc.createNewObject("MySpace.MyClass"))
or
#set( $objnr =
$xwiki.getDocument("MySpace.MyDocument").createNewObject("MySpace.MyClass"))
This will return you the number of the object.
Then you can do #set( $myobj = $doc.getObject("MySpace.MyClass",$objnr) )
and this will get you the actual object
Or even directly:
#set($myobj = $doc.newObject("MySpace.MyClass"))
Hope it helps ;)
Kamna Jain wrote:
> Hello,
> Can anybody tell me how to add an object of an already created class to a
> new page using Velocity...not the interface provided by Xwiki.
> Which method do I need to call to achieve this!!!
>
> Thanks