[opencms-dev] Creating Files Programatically in version 5.0

Steve Harder SHarder at greenridge.ca
Tue Mar 1 18:22:50 CET 2005


Hello,

While I am able to create and write to files in the VFS a jsp file in the offline project, as soon as I switch to the online project, I get an exception as follows:

Root cause:
org.apache.jasper.JasperException: com.opencms.core.CmsException: [com.opencms.file.mySql.CmsResourceBroker] /default/vfs/Adm/survey/text.txt

Here is the code I am using:

String foldername = "/Adm/survey/";
String filename = "text.txt";
CmsJspActionElement cmsAction = new CmsJspActionElement(pageContext, request, response);
CmsObject cms = cmsAction.getCmsObject();

CmsFile newfile = (CmsFile)cms.createResource(foldername, filename,"plain");


The path mentioned in the code exists before execution. I have found in the archives, where files for the vfs are being created, and I am more or less using that code here. Has anyone done this before, successfully in the online project? Any code snippets, or ideas are very welcome.

Thanks for your help,

Steve

-------------------------------------------------------------------------------------------------------------------
This communication, including its attachments, if any, is intended solely
for the recipient; it is confidential and may contain personal or private
information, or proprietary and/or privileged material. As such, any
unauthorized use, retention, copying, disclosure or other distribution of
this communication, or the taking of any action in reliance on its contents
is strictly prohibited. If you have received this communication in error,
please notify us immediately and delete this communication (and any
attachments.)




More information about the opencms-dev mailing list