1
votes

I have a button on an XPage that has no data source. I have read that I cannot use currentDocument to grab the current document:

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.api.doc%2Fr_wpdr_xsp_xspdocument_r.html

I have read about using DominoDocumentData class, but not sure how to get that to grab the current document:

http://public.dhe.ibm.com/software/dw/lotus/Domino-Designer/JavaDocs/XPagesExtAPI/8.5.2/com/ibm/xsp/model/domino/DominoDocumentData.DocumentProperties.html

What is best coding technique to grab the current document with no data source on the XPage? Samples would be great...

Thanks! Dan

1
If you do not have a document data source on your Xpage then you do not have a currentDocumentSven Hasselbach
Please define 'current document'. As Sven already pointed out. When you dont have a datasource you can't speak of a current document simple because there is none. If you mean that you want to get data from a document which is specified by a url parameter you could simple load the document, do your stuff, and remove the reference again..jjtbsomhorst
To echo the above in another way, XPages is based primarily on JSF, which is very much in tune with the "model-view-controller" philosophy (model = data, view = UI, controller = business logic). If you don't have a data source, there's no data model for the view (the user interface) to talk to. Given the simplicity of defining data sources, why would you want to omit them?Tim Tripcony
"Current Document" is the current XPage -- I called it a document since I am still getting used to XPages. So the solution is to have the XPage have a data source -- I am not sure why this XPage has no data source -- this was from a previous developer and I am trying to add some code to it. Is there any way to get a handle on the document (the current XPage that is open) to get values from fields, etc. without a data source and use the native Domino/XSP classes? Or just put a data source on the XPage and go that way?Dan
In a word, yes. An XPage is pointless without at least one data source. Each XPage is a user interface; a "document" is data... physical storage. In the Notes client, there's no distinction: one form = one document. In XPages, data sources define how the user interface reads and writes data. So your fields don't have to be bound to a document data source, but they need to be bound to something. Otherwise, they're just part of the UI, disconnected from any actual persistent storage.Tim Tripcony

1 Answers

2
votes

CurrentDocument refers to a data source and not to the current xpage, which in JSF terms is a view (not to confuse with database view) existing only in memory (including temporary persistence in the disk cache). You could use context.getView() to get hands on it. However in SSJS you can get any component using getComponent for any component access.

I suspect you need something completely different. An XPage doesn't store anything, so you need to look for the data binding. Typically it is a data source, a bean or a scope. In the worst case the previous developer didn't get XPages and manually populates control values in an event and saves them in one too