0

我正在尝试将文件附加到注释文档,但出现以下错误。

 var doc:NotesDocument = DS_EmpDetails.getDocument();
 var rtitem:NotesRichTextItem = doc.createRichTextItem("AttachmentField");
 var Attachment:String = "C:\\Users\\karthick_m\\Desktop\\PDFIcon.jpg"; 
 var emobj:NotesEmbeddedObject = rtitem.embedObject(NotesEmbeddedObject.EMBED_ATTACHMENT, "", Attachment, null);
 doc.save();

我收到以下错误..

 [TypeError] Exception occurred calling method NotesRichTextItem.embedObject(number, string, string, string) null

提前致谢...

我的堆栈跟踪 堆栈跟踪

javax.faces.FacesException:执行 JavaScript 操作表达式 com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:102) com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210) com 时出错。 sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96) com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:250) com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java: 206) com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:189) com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:154) com.ibm.xsp.webapp.FacesServletEx.service( FacesServletEx.java:137) com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:86) com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:538) com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1140) com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:803) com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:758) com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:527) com.ibm。 domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1124) com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:513) com.ibm.domino.xsp.module。 nsf.NSFService.doService(NSFService.java:342) com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:304) com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service( LCD环境。java:261) com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:291) com.ibm.xsp.exception.EvaluationExceptionEx:执行 JavaScript 操作表达式 com.ibm.xsp 时出错。 binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:126) com.ibm.xsp.application.ActionListenerImpl.processAction(ActionListenerImpl.java:60) javax.faces.component.UICommand.broadcast(UICommand.java:324) com. ibm.xsp.component.UIEventHandler.broadcast(UIEventHandler.java:365) com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400) com.ibm.xsp.component.UIViewRootEx.broadcast(UIViewRootEx.java:第1490章、InvokeApplicationPhase.execute(InvokeApplicationPhase.java:94) com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96) com.ibm。 xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:250) com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:206) com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:189) com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:154) com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137) com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.爪哇:86)96) com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:250) com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:206) com.ibm.xsp.webapp.FacesServletEx.serviceView( FacesServletEx.java:189) com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:154) com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137) com.ibm.xsp.webapp。 DesignerFacesServlet.service(DesignerFacesServlet.java:86)96) com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:250) com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:206) com.ibm.xsp.webapp.FacesServletEx.serviceView( FacesServletEx.java:189) com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:154) com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137) com.ibm.xsp.webapp。 DesignerFacesServlet.service(DesignerFacesServlet.java:86)DesignerFacesServlet.service(DesignerFacesServlet.java:86)DesignerFacesServlet.service(DesignerFacesServlet.java:86)

4

2 回答 2

3

使用上传控件。您使用 SSJS 代码的方式仅适用于服务器上已经存在的文件 - 您没有上传它。

于 2012-05-02T08:11:00.817 回答
0

上面的错误消息可能是错误的,但它指出原因是“ritem”变量为空。你在你的代码中检查过这个吗?

if (!rtitem) throw new java.lang.Exception("Uh oh!");
于 2012-05-02T15:38:20.060 回答