[opencms-dev] create new Resource

Hartmann, Waehrisch & Feykes GmbH hartmann at waehrisch-feykes.de
Wed Oct 29 13:18:01 CET 2003


Hi Federico,

maybe i misunderstood you, too.
The error could be that your CmsResourceTypePage is not initialized.
You should not instantiate it on your own but use 
cmso.getResourceType("page");
Don't forget to cast.

Bye,
Stephan

  ----- Original Message ----- 
  From: Federico Locci 
  To: opencms-dev at opencms.org 
  Sent: Wednesday, October 29, 2003 12:16 PM
  Subject: Re: [opencms-dev] create new Resource


  Scuse me, 

  but i don't uderstand

  I've try

  Hashtable properties = new Hashtable();

  properties.put("Description","page");
  properties.put("Keywords","page");
  properties.put("NavPos","4.0");
  properties.put("NavText","page");
  properties.put("title","page");
  properties.put("content-encoding","ISO-8859-1");

  CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,response);
  CmsObject cmso = cms.getCmsObject(); 
  String masterTemplate = ""/system/modules/org.opencms.default/templates/empty";

  CmsResourceTypePage resource = new CmsResourceTypePage();
  String buffer = "<![CDATA[hello world]]>";
  com.opencms.file.CmsResource r = resource.createResourceForTemplate(cmso,"new_page",properties,buffer.getBytes(),masterTemplate);    

  but error is the same : Root cause:
  org.apache.jasper.JasperException: String index out of range: -1
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
   

  Can you give me a example ??

  Thanks, a lot





  ----- Original Message ----- 
  From: "Stephan Hartmann" <beffe at beffe.de>
  To: <opencms-dev at opencms.org>
  Sent: Tuesday, October 28, 2003 8:30 PM
  Subject: Re: [opencms-dev] create new Resource


  > HI,
  > 
  > the content that you pass to the method (in your case "hello") has to be
  > XML. It is the content of the control file. Take another page and view its
  > control file.
  > 
  > Bye,
  > Stephan
  > 
  > 
  > ----- Original Message -----
  > From: "Federico Locci" <flocci at energit.it>
  > To: <opencms-dev at opencms.org>
  > Sent: Tuesday, October 28, 2003 5:56 PM
  > Subject: [opencms-dev] create new Resource
  > 
  > 
  > > hi all,.
  > >
  > > i'm trying to create a newResource, but i've a an error that i don't
  > > udenrstand.
  > >
  > > Help me please..
  > > the error is org.apache.jasper.JasperException: String index out of
  > > range: -1
  > >
  > > This is the code that i wrote:
  > >
  > > CmsJspActionElement cms = new CmsJspActionElement(pageContext,
  > > request,response);
  > >  CmsObject cmso = cms.getCmsObject();
  > >
  > >
  > > java.util.Hashtable properties = new Hashtable();
  > >
  > >
  > >     properties.put("Description","page");
  > >     properties.put("Keywords","page");
  > >     properties.put("NavPos","4.0");
  > >     properties.put("NavText","page");
  > >     properties.put("title","page");
  > >     properties.put("content-encoding","ISO-8859-1");
  > >     properties.put("export","page");
  > >     properties.put("exportname","page");
  > >
  > >
  > >
  > >     CmsResourceTypePage resource = new CmsResourceTypePage();
  > >     com.opencms.file.CmsResource newResource =
  > > resource.createResourceForTemplate(cmso,"new_page.html",properties,new
  > > String("hello").getBytes(),new
  > > String("/system/modules/org.opencms.default/templates/empty"));
  > >
  > > _______________________________________________
  > > This mail is send to you from the opencms-dev mailing list
  > > To change your list options, or to unsubscribe from the list, please visit
  > > http://mail.opencms.org/mailman/listinfo/opencms-dev
  > 
  > _______________________________________________
  > This mail is send to you from the opencms-dev mailing list
  > To change your list options, or to unsubscribe from the list, please visit
  > http://mail.opencms.org/mailman/listinfo/opencms-dev
  > 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20031029/41a0015d/attachment.htm>


More information about the opencms-dev mailing list