[opencms-dev] jsp and html page

Jens Rickhoff jens at visualteam.de
Wed Aug 13 09:35:02 CEST 2003


RE: [opencms-dev] jsp and html pageHi Yendung,

You don't need to out.print() the whole thing. And you can't. Just writing:
cms.include(filename);
will include the content of filename at that position. If you want to work
with the content of filename, you can use the following structure:

CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);
CmsObject cmso = cms.getCmsObject();
byte[] bContent = cmso.readFile(filename).getContents();
String sContent = new String(bContent,
cmso.getRequestContext().getEncoding());

The variable sContent now contains the content of filename as string which
you
then can further process.

Jens

----- Original Message -----
From: Nguyen La Yen Dung
To: opencms-dev at opencms.org
Sent: Wednesday, August 13, 2003 5:23 AM
Subject: RE: [opencms-dev] jsp and html page




Hi Jens,
Thank you for your reply.
A little hope for my problem:-)
The include() method gets a String parameter-That is what I'm looking for
but now I'm facing another error:
"Incompatible type for method. Can't convert void to java.lang.Object.
out.print(cms.include(filename)); ^ 1 error, 1 warning "
Have you ever met this error message?
Could you please help me once more time?
Thank you,
Yendung


-----Original Message-----
From: Jens Rickhoff [mailto:jens at visualteam.de]
Sent: 12 August 2003 18:25
To: opencms-dev at opencms.org
Subject: Re: [opencms-dev] jsp and html page


jsp and html pageHi Yendung,
try using
<%=cms.include(filename) %>
instead. cms is a CmsJspActionElement object.
Hope that helps. I think the cms tags are evaluated before the JSP code is
executed.
Correct me if I'm wrong.
Cheers,
Jens
----- Original Message -----
From: Nguyen La Yen Dung
To: opencms-dev at opencms.org
Sent: Tuesday, August 12, 2003 1:07 PM
Subject: RE: [opencms-dev] jsp and html page


Hi,
I don't know if it is correct or not, but it only works with
<cms:include file="mypage.html" />
If any one knows the reason, please explain me. Thanks.
Another problem I've met is: I don't want to hardcode the file name, I want
to use a String variable here,
but <cms:include file="<%= filename %>" /> will raise an exception File not
found.
I see the value of <%= filename %> doesnot parse.
Why?
Please help me.
Yendung





 -----Original Message-----
From: Nguyen La Yen Dung
Sent: 12 August 2003 11:36
To: opencms-dev at opencms.org
Subject: [opencms-dev] jsp and html page




 Hi,
 I meet a problem with <jsp:include> tag. Please help.
 I create a simple html page in Opencms (mypage.html):
 <![CDATA[
  Hello
 ]]>


 In jsp file, I use
<jsp:include page="mypage.html" flush="true"/>
 Run this jsp, an empty page is shown.
 What's wrong?
Thank you,
 Yendung
_______________________________________________
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