Thank you for pointing the error about "text.html", I mistyped it.
That part is correct, no new window is launched.   Referring to my previous
question, am I taking the right approach to read the content of the htm
files? I want to be able to capture the content as one big string, edit the
content and display the new edited content to customer.
I have tried using the code that I posted, it give me nothing ... after
clicking the link, just white space, not a single word.  I checked the
path, it is correct. I attached the code below.
Thank you.

Andi Setiyadi


import ...

public class PersonnetDocContents extends HttpServlet        {
     public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException     {
          int i;
          String path = "";
          String docContent = "";
          String docID = req.getParameter("docID");     //16 digit id
          BufferedReader buffer = null;

          res.setContentType("text/html");
          PrintWriter out = res.getWriter();

          for(i=1 ; i<4 ; i++)                          //each 4 ids
represent a folder name
          {
               path = path + docID.substring(0,4) + "/";
               docID = docID.substring(4);
          }

          path = "/docs/" + path + docID + ".htm";
          URL docs = new URL("http://myhostname/pnet"; + path);
          URLConnection docsConnection = docs.openConnection();

          buffer = new BufferedReader(new
InputStreamReader(docsConnection.getInputStream()));
          docContent = buffer.readLine();
          buffer.close();

          out.println(docContent);
     }
}







                    "Christopher K. St.
                    John"                        To:     [EMAIL PROTECTED]
                    <[EMAIL PROTECTED]        cc:
                    M>                           Subject:     Re: reading and edit 
document on the fly in servlet
                    Sent by: "A mailing
                    list for discussion
                    about Sun
                    Microsystem's Java
                    Servlet API
                    Technology."
                    <SERVLET-INTEREST@JAV
                    A.SUN.COM>


                    05/21/01 03:26 PM
                    Please respond to "A
                    mailing list for
                    discussion about Sun
                    Microsystem's Java
                    Servlet API
                    Technology."






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
users
> to save it (as if users try to download it).
>

 I'm assuming the code you posted was edited down from
the real code, so the content type thing might just be
a typos, but:

 1) The content types should probably have a slash instead
    of a peried, "text/html" instead of "text.html"

 2) Is the document really just a single line long?

 3) Probably not the problem here, but IE sometimes ignores
    content type, nothing you can do about it (It's a
    Microsoft 'feature')

 4) If you say "yes, save it" to the dialog, is the saved
    content correct?

--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

___________________________________________________________________________
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

___________________________________________________________________________
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

Reply via email to