Thanks DR.

I'll prefer to convert an RTF doc. into HTML before displaying on the
browser.



-----Original Message-----
From: David Rosenstrauch [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 3:49 PM
To: JDJList
Subject: [jdjlist] RE: convert rtf to html


Hi Emmanuel.  Sorry for the late response.

I'm not really sure what you are trying to achieve, so I'm not sure how to
help you with it.

* Are you trying to have your servlet/JSP serve up an RTF doc?  If so, then
setting the mime type to "application/rtf" is the right thing to
do.  However, what the browser decides to do when it gets served an
"application/rtf" document is browser dependent.  Microsoft IE will
probably open MS Word right inside the browser and open your RTF document
in that.  Netscape, Opera, etc. probably wouldn't.  On my project, I wanted
the RTF document to be a download (like the behavior you described, with a
windows download dialog box).  To do that I set the MIME type to rtf, set
the header to indicate a download
(response.addHeader("Content-Disposition", "attachment; filename=" + QUOTE
+ filename + QUOTE);), and everything worked fine.

* Are you trying to convert an RTF doc. into HTML?  If so, then you need to
use a parser that will parse RTF, and then write code that will generate
HTML output.

If you can clarify what you're trying to do a little more, then I can
probably help more.


DR


At 10:11 AM 9/6/2002 +0200, you wrote:

>Pls DR can u send me a sample code which can enable me achieve it.
>I tried the following code and only got the windows download dialog which
>actually downloaded the rtf file.
>
><%-- Page Directives --%>
><%@ page language="java" buffer="8kb" autoFlush="true" isThreadSafe="true"
>isErrorPage="false" errorPage="ErrorPage.jsp" %>
>
><%@ include file="sec.jsp"%>
>
><%@ page import = "com.sybase.jaguar.jcm.*" %>
><%@ page import = "java.sql.*" %>
><%
>         response.setContentType("application/rtf");
>
>         String sql = "select statement_name from company_details where
>parameter_code='ST' and statement_type='MISSN' order by row_counter";
>
>         JCMCache cache = JCM.getCacheByName("SelfServiceDB");
>         Connection conn = cache.getConnection(JCMCache.JCM_WAIT);
>         Statement stmt =
> conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
>ResultSet.CONCUR_READ_ONLY);
>
>         ResultSet resultSet = stmt.executeQuery( sql );
>         while (resultSet.next()){
>                 out.print(resultSet.getString(1));
>         }
>
>%>
>
>-----Original Message-----
>From: David Rosenstrauch [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, September 05, 2002 7:50 PM
>To: JDJList
>Subject: [jdjlist] RE: convert rtf to html
>
>
>Yes.  Use mime type "application/rtf".  (I mention this in my article,
>which I referenced in my response to your first rtf question.)
>
>
>DR
>
>
>At 06:38 PM 9/5/2002 +0200, you wrote:
> >Is there a way I can display a rtf document on a web page by way of
setting
> >a MIME TYPE or something?
> >
> >-----Original Message-----
> >From: Jason Bell [mailto:[EMAIL PROTECTED]]
> >Sent: Thursday, September 05, 2002 3:15 PM
> >To: JDJList
> >Subject: [jdjlist] RE: convert rtf to html
> >
> >
> >nothing springs to mind......
> >
> >try this
> >www.google.com
> >in the search box type:
> >
> >"converting rtf to html with jsp"
> >
> >
> >
> >rgds
> >jase
> >
> >
> >-----Original Message-----
> >From: Emmanuel Eze [mailto:[EMAIL PROTECTED]]
> >Sent: 05 September 2002 13:12
> >To: JDJList
> >Subject: [jdjlist] convert rtf to html
> >
> >
> >Hi all,
> >
> >Can somebody pls tell me how I can convert a rich text document(rtf) I'm
> >reading from the database to html for display with my JSP page.
> >
> >Thanks.



To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm


To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm

Reply via email to