Hi
I think you'll need in your User class to use
$xwiki.parseGroovyFromPage("ParentObject")
Before that you need to pass $xwiki to User class.
public class User extends ParentObject {
private xwiki = null;
void setUser() {
if (session.getValue("counter") != null)
this.counter = session.getValue("counter") + 1;
else
this.counter = 1;
session.setAttribute("counter", this.counter);
}
String showCounter() {
return this.counter;
}
public void setXwiki(xwiki)
{
this.xwiki = xwiki;
}
}
-----Original Message-----
From: users-bounces(a)xwiki.org [mailto:users-bounces@xwiki.org] On Behalf
Of Jan Cerny
Sent: 24 March 2009 08:43
To: users(a)xwiki.org
Subject: [xwiki-users] Using parseGroovyFromPage on inherited class
Hi,
I have another problem. I want to use a class that extends a parent
class and then use parseGroovyFromPage.
But I can't work out how to do it. An example here:
---------------------------------------------------------------------
page ParentObject:
<%
class ParentObject {
def counter = 0;
def session;
void setSession(session) {
this.session = session;
}
}
%>
---------------------------------------------------------------------
page UserClass:
/* Groovy Class #* */
public class User extends ParentObject {
void setUser() {
if (session.getValue("counter") != null)
this.counter = session.getValue("counter") + 1;
else
this.counter = 1;
session.setAttribute("counter", this.counter);
}
String showCounter() {
return this.counter;
}
}
/* *# */
---------------------------------------------------------------------
script page:
#set ($groovyObject = $xwiki.parseGroovyFromPage("Include.UserClass"))
---------------------------------------------------------------------
The question is how to include the ParentObject page into UserClass
page, so that UserClass can extend the ParentObject.
Any help would be appreciated.
Thanks, Zik
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--------------------------------------------------------
NOTICE
This message and any files transmitted with it is intended for the addressee only and may
contain information that is confidential or privileged. Unauthorised use is strictly
prohibited. If you are not the addressee, you should not read, copy, disclose or otherwise
use this message, except for the purpose of delivery to the addressee.
Any views or opinions expressed within this e-mail are those of the author and do not
necessarily represent those of Coventry University.