[opencms-dev] OCMS5- Create folder and html page from JSP

James jim at futurate.com
Tue Nov 22 12:44:47 CET 2005


How do I create a folder and an html page inside that folder from within a
JSP page on my website???

 

I’ve tried this:

 

<%@ page import="com.opencms.flex.jsp.CmsJspActionElement,

                 com.opencms.core.CmsException,

                 com.opencms.file.CmsObject,

                 com.opencms.file.CmsUser,

                 com.opencms.file.CmsRequestContext,

                 java.lang.String,

                 java.util.Enumeration"

%>

 

<%

CmsJspActionElement cmsjsp = new CmsJspActionElement( pageContext, request,
response );

CmsObject cms = cmsjsp.getCmsObject();

 

 

 // CmsObject cms =
((com.opencms.flex.cache.CmsFlexRequest)request).getCmsObject(); 

//  CmsRequestContext reqContext = cms.getRequestContext(); 

 // out.print(cms.loginUser("Admin","administrators")); 

 // reqContext.setCurrentProject(4); //in my DB project_id = 4 

  String content = "test"; 

 
cms.createResource("/opencms/opencms/cida/creativeweb/newminisite/","newpage
.html", "plain", null, content.getBytes()); 

 
cms.unlockResource("/opencms/opencms/cida/creativeweb/newminisite/newpage.ht
ml"); 

 
cms.publishResource("/opencms/opencms/cida/creativeweb/newminisite/newpage.h
tml"); 

//  reqContext.setCurrentProject(1); 

 

%>

 

But don’t really know what I’m doing to be honest!

 

Can anyone point me in the right direction?

 

THANKYOU…………**************** xxxxxxxxxxxxxxxxxxx


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.5/177 - Release Date: 21/11/2005
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20051122/05f3f376/attachment.htm>


More information about the opencms-dev mailing list