Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Write data into files using servlet


Message #1 by "Jastin" <shihui06@h...> on Sat, 22 Jun 2002 03:14:23
my guess is that the file is created but not where you expect it. Try doing
a search on your hard drive for myfle.txt. I bet it turns up somewhere you
dont expect

chanoch

----- Original Message -----
From: "David Mitchell" <dave@d...>
To: "Servlets" <servlets@p...>
Sent: Saturday, June 22, 2002 7:18 AM
Subject: [servlets] Re: Write data into files using servlet


> Jastin wrote:
> > hi,
> >
> > i am trying to write data from datatbase into files using servlet.
> > The following is my code:
> >
> > public class writeFiles extends HttpServlet
> > {
> > public void doGet(HttpServletRequest request, HttpServletResponse
response)
> > throws ServletException, IOException
> > {
> > response.setContentType("text/html");
> > PrintWriter outLine = response.getWriter();
> >         try
> > {
> > fout = new FileOutputStream ("myfile.txt");
> > new PrintStream(fout).println ("hello world!");
> > fout.close();
> >          }
> >         catch(IOException e){}
> > }
> > }
> >
> >
> >
> > But how come the file(myfile.txt) is not created? can anyone help me?
> > thanks
> >
> >
>
> Not really sure offhand. What happpens when you put outline.println(e)
> within your catch statement? That might give you some clues as to what's
> going on...
>
> Dave
> http://java.dbmdata.com
>
>


  Return to Index