[opencms-dev] create new Resource
Federico Locci
flocci at energit.it
Wed Oct 29 16:06:01 CET 2003
Hi,
the 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)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
code :
String masterTemplate = "/system/modules/org.opencms.default/templates/empty";
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();
I_CmsResourceType resource = cmso.getResourceType("page");
String buffer = "<![CDATA[]]>";
com.opencms.file.CmsResource r = ((CmsResourceTypePage)resource).createResourceForTemplate(cmso,"new_page.html",properties,buffer.getBytes(),masterTemplate);
----- Original Message -----
From: Hartmann, Waehrisch & Feykes GmbH
To: opencms-dev at opencms.org
Sent: Wednesday, October 29, 2003 12:46 PM
Subject: Re: [opencms-dev] create new Resource
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/f079262d/attachment.htm>
More information about the opencms-dev
mailing list