[opencms-dev] openCms wysiwyg problem after createResource()
Christian Fleron Guldner
cfg at pbs.dk
Mon Oct 27 16:44:02 CET 2003
Hi,
I have worked a little with your code and may have found a solution.
Try substituting your try block with this:
try {
String folderName = "/Home/";
String pageName = "uputstvo.html";
CmsResource newFile = cms.createResource(folderName, pageName
,"page",props,contents);
String bodyFolder =(I_CmsWpConstants.C_VFS_PATH_BODIES.substring(0,
I_CmsWpConstants.C_VFS_PATH_BODIES.lastIndexOf("/"))) + folderName;
CmsXmlControlFile pageXml = new CmsXmlControlFile(cms,
(CmsFile)newFile);
pageXml.setTemplateClass("com.opencms.template.CmsXmlTemplate");
pageXml.setMasterTemplate("/system/modules/org.opencms.default/templa=
tes/empty");
pageXml.setElementClass("body",
"com.opencms.template.CmsXmlTemplate");
pageXml.setElementTemplate("body", bodyFolder + pageName);
pageXml.write();
}
Regards,
Christian Güldner
You wrote:
------------------------------------------------------------------
Hi, I use this code for creating file. File is successfully created but I
have have problem when I want to edit it in WYSIWYG editor:
CmsJspActionElement cmsJSP = new CmsJspActionElement(pageContext, request,
response); CmsObject cms = cmsJSP.getCmsObject(); Hashtable props = new
Hashtable();
props.put("Title","Uputstvo");
props.put("Description","Ovo je opis stranice");
props.put("Keywords","kljucna1, kljucna2, klucna3");
props.put("NavText","Uputstvo za sajt");
try { CmsResource newfile =
cms.createResource("/Home/","uputstvo.html","page",props,contents);
CmsXmlControlFile controlFile = new CmsXmlControlFile(cms,
(CmsFile)newfile);
controlFile.setMasterTemplate("/system/modules/org.opencms.default/templates/empty");
controlFile.write();
} catch(CmsException e) { out.println("Greska !!!");
}
When I try to edit this page in WYSIWYG editor I got blank page. But, page
is successfully displayed in browser with its content. Then when I
switched form WYSIWYG editor I saw exception something like this:
CmsException ID:0 String index out of range: -6 Can anyone help me? I am
using OpenCMS 5, Oracle 8.1.7 (Generic), Tomcat 4.1.24LE on W2K.
Best regards, Ivan.
More information about the opencms-dev
mailing list