Hello Andi,
Tuesday, May 22, 2001, 9:24:35 PM, you wrote:
just point all *.html files in that folder to java container. and
process them on the fly.
AS> Thank you for pointing the error about "text.html", I mistyped it.
AS> That part is correct, no new window is launched. Referring to my previous
AS> question, am I taking the right approach to read the content of the htm
AS> files? I want to be able to capture the content as one big string, edit the
AS> content and display the new edited content to customer.
AS> I have tried using the code that I posted, it give me nothing ... after
AS> clicking the link, just white space, not a single word. I checked the
AS> path, it is correct. I attached the code below.
AS> Thank you.
AS> Andi Setiyadi
AS> import ...
AS> public class PersonnetDocContents extends HttpServlet {
AS> public void doGet(HttpServletRequest req, HttpServletResponse res)
AS> throws ServletException, IOException {
AS> int i;
AS> String path = "";
AS> String docContent = "";
AS> String docID = req.getParameter("docID"); //16 digit id
AS> BufferedReader buffer = null;
AS> res.setContentType("text/html");
AS> PrintWriter out = res.getWriter();
AS> for(i=1 ; i<4 ; i++) //each 4 ids
AS> represent a folder name
AS> {
AS> path = path + docID.substring(0,4) + "/";
AS> docID = docID.substring(4);
AS> }
AS> path = "/docs/" + path + docID + ".htm";
AS> URL docs = new URL("http://myhostname/pnet" + path);
AS> URLConnection docsConnection = docs.openConnection();
AS> buffer = new BufferedReader(new
AS> InputStreamReader(docsConnection.getInputStream()));
AS> docContent = buffer.readLine();
AS> buffer.close();
AS> out.println(docContent);
AS> }
AS> }
AS> "Christopher K. St.
AS> John" To:
[EMAIL PROTECTED]
AS> <[EMAIL PROTECTED] cc:
AS> M> Subject: Re: reading and edit
document on the fly in servlet
AS> Sent by: "A mailing
AS> list for discussion
AS> about Sun
AS> Microsystem's Java
AS> Servlet API
AS> Technology."
AS> <SERVLET-INTEREST@JAV
AS> A.SUN.COM>
AS> 05/21/01 03:26 PM
AS> Please respond to "A
AS> mailing list for
AS> discussion about Sun
AS> Microsystem's Java
AS> Servlet API
AS> Technology."
AS> Andi Setiyadi wrote:
>>
>> The problem is, when users click a link to open a documents, it is not
>> displaying the contents, instead it will launch a window and ask the
AS> users
>> to save it (as if users try to download it).
>>
AS> I'm assuming the code you posted was edited down from
AS> the real code, so the content type thing might just be
AS> a typos, but:
AS> 1) The content types should probably have a slash instead
AS> of a peried, "text/html" instead of "text.html"
AS> 2) Is the document really just a single line long?
AS> 3) Probably not the problem here, but IE sometimes ignores
AS> content type, nothing you can do about it (It's a
AS> Microsoft 'feature')
AS> 4) If you say "yes, save it" to the dialog, is the saved
AS> content correct?
AS> --
AS> Christopher St. John [EMAIL PROTECTED]
AS> DistribuTopia http://www.distributopia.com
AS> ___________________________________________________________________________
AS> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
AS> of the message "signoff SERVLET-INTEREST".
AS> Archives: http://archives.java.sun.com/archives/servlet-interest.html
AS> Resources: http://java.sun.com/products/servlet/external-resources.html
AS> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
AS> ___________________________________________________________________________
AS> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
AS> of the message "signoff SERVLET-INTEREST".
AS> Archives: http://archives.java.sun.com/archives/servlet-interest.html
AS> Resources: http://java.sun.com/products/servlet/external-resources.html
AS> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
--
Best regards,
Alexander mailto:[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html