Hi Paul
I have a form with two fields such as Title (field type:text) and Body (Rich Text). I created and submitted a document (with text and attachment). In the Xpage, i have a edit box (title),a file upload and download control for attachment & a (save) button. I did not find any issue in creating and saving the document but i edited the same document and deleted the attachment. After deleting the attachment, i tried to save the document but it did not work. To save the document, i use the java class which is located under “WEBCONTENT/WEB-INF/src”. I have written the java class by opening the db in the java perspective.
save button: (serverside javascript)
try{
var doc:NotesDocument=ContentDoc.getDocument(true);
var objDoc = new com.text.DocumentActions();
objDoc.docSave();
context.redirectToPage(“./test.xsp?documentId=”+doc.getUniversalID()+“&action=editDocument”);
}catch(e){
print(“err:”+e) ;
}
Java Class:
public class DocDocument {
private static Logger logger = Logger.getLogger(DocDocument.class);
Session session = null;
Database db = null;
Document document = null;
public DocDocument(Document CurDoc) throws NotesException {
this.session = Helper.getCurrentSession();
this.db = CurDoc.getParentDatabase();
this.document = CurDoc;
}
public void docSave() throws Exception{
try{
document.save(true,false);
}catch(Exception e){
throw e;
}
}
}
Error:
Error while executing JavaScript action expression
Script interpreter error, line=3, col=49: [TypeError] Exception occurred calling method NotesXspDocument.getDocument(boolean) null.
Could you pls help me on this ?. Is it a bug ?.
Regards,
Karthik KS