Hello devs,

got a really newbie question and sitting on it for hours.
Your help will be appreciated. All I am trying to do is
- writing a Java class which has a method - when called
with doc name/ID will return the document title. That is all.
The following code is what Itried:

import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.api.Api;
import com.xpn.xwiki.api.XWiki;
import com.xpn.xwiki.doc.XWikiDocument;


public class SampleService extends Api
{
        public SampleService()
        {
                super();   ///   I guess there should be XwikiContext parameter 
in
the constructor
        }
        public String myDocTitle(String:name)
        {
                com.xpn.xwiki.doc.XWikiDocument docu =
context.getWiki().getDocument("theSpace.theDoc", context);  //   I do
not where to get this context from
                return docu.getTitle();
        }
}
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to