Hi Shawn,

On Jan 22, 2007, at 8:02 PM, Shawn Lauzon wrote:


Hi all --

I'm working to create an xwiki app that allows you to press a button, and it sends you to a new page with a generated name (i.e. not based on any user input). I can get this to work with a page name generated from the current time in milliseconds, but that gives me a really long number. I'd like to have the generated name be a number which is incremented any time a new page is created. Thus I would have pages Page_1, Page_2, Page_3, etc. I looked in our scriptlets section, but didn't see anything close.

You'll need the counter to be saved in the db so that it persists over time. One way of doing it is by creating a very simple class (say CounterClass), with an integer or a long property type and then attach this object to a document. Then whenever you create a new page you increment the counter.

-Vincent