[opencms-dev] How to instantiate a new CmsJspActionElement into a servlet ?

Xavier Ottolini xavier.ottolini at adelis.com
Tue Dec 21 12:20:31 CET 2004


Thanks Andras.

Now this error is no more generated.
I instantiate my CmsJspActionElement object like this :

_jspxFactory = JspFactory.getDefaultFactory();
pageContext = _jspxFactory.getPageContext(this, request, response,null, 
true, 8192, true);
cms = new  CmsJspActionElement(pageContext,request,response);
redirect = cms.link("/www/fr/ecard/cartes.jsp");


The problem is that cms.link returns the following string : "+++ error 
generating link to '/www/fr/ecard/cartes.jsp' +++"
I should tell to the CmsJspActionElement that it is in the opencms VFS. 
How can I do this ?

Regards,

Xavier Ottolini
Développeur multimédia

Adelis
37, rue d'Engwiller
F-67350 La Walck
Téléphone : +33 (0) 3 88 72 29 10
Télécopie : +33 (0) 3 88 72 29 19
http://www.adelis.com




Andras Balogh a écrit :

> Hello,
>
> You can create a test.jsp in OpenCms than take a look at the the 
> temporary java file made by your servler container
> (ex. in Tomcat: 
> C:\jakarta-tomcat-5.0.16\work\Catalina\localhost\opencms\org\apache\jsp\WEB_002dINF\jsp\..) 
>
> I see something like this on my jsp:
> _jspxFactory = JspFactory.getDefaultFactory();
> response.setContentType("text/html;charset=UTF-8");
> pageContext = _jspxFactory.getPageContext(this, request, 
> response,null, true, 8192, true);
>
> Best regards,
> Andras.
>
> Xavier Ottolini wrote:
>
>> Hi,
>>
>> I would like to instantiate a new CmsJspActionElement into a servlet. 
>> Then my servlet should be able to find resources in the virtual file 
>> system.
>>
>> If I want to create a new CmsJspActionElement, I need to instantiate 
>> a PageContext. That is a real problem.
>>
>> JspFactory  factory     = JspFactory.getDefaultFactory();
>> errorUrl = http://www.mydomain.com/error.html
>> PageContext pageContext = 
>> factory.getPageContext(this,_request,_response,errorUrl,true,JspWriter.DEFAULT_BUFFER,true); 
>>
>>
>> I get the following exception :
>>
>> 2004-12-21 10:37:36 PageContextImpl: creating out
>> java.lang.IllegalArgumentException: Buffer size <= 0
>>        at 
>> org.apache.jasper.runtime.JspWriterImpl.<init>(JspWriterImpl.java:130)
>>        at 
>> org.apache.jasper.runtime.PageContextImpl._createOut(PageContextImpl.java:543) 
>>
>>        at 
>> org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:147) 
>>
>>        at 
>> org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:114) 
>>
>>        at 
>> org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:175) 
>>
>>        at 
>> org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:154) 
>>
>>        at com.mycompany.MyServlet.goGet(MyServlet.java:100)
>>
>> Has anybody any idea ?
>>
>> Regards,
>>
>> Xavier
>>
>>
>>
>> _______________________________________________
>> 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




More information about the opencms-dev mailing list