hi,
just try to give an absolute path while creating the file (may not be a
good suggestion, because it hinders portability).
PrintStream dout=new PrintStream(new FileOutputStream("c:\out.txt"));
regds,
Vishwa
Mehmet Gok wrote:
>
> hi again
> i have tried it too. but nothing changes.
> I mean in doPost() i create file write some data into it, etc..
> but the problenm is that file does not exist in my computer. (out.txt)
> i mean when i try to find it i can not find it.
> also i tried to create file in init() method and then write data into
> it..but nothing changes..
> i have to solve this problem. help pls
> thanks
>
> On Sat, 29 Apr 2000, [iso-8859-9] U�ur Karakaya wrote:
>
> > For opening and writing string a output file, you can use these;
> >
> > PrintStream dout=new PrintStream(new FileOutputStream("out.txt"));
> > dout.print(xmax); //or dout.println(xmax);
> > dout.print(sample); //or dout.println(sample);
> > dout.close();
> >
> > For more information Look --> java.io.PrintStream
> >
> > Ugur
> >
> > Mehmet Gok wrote:
> >
> > > hi everybody
> > > firstly I'm new in servlet programming.
> > > My problem is:
> > > I have a HTML form. By using servlets I read the data in this form and
> > > then in a new page I print this data. It works, namely i can read data and
> > > print it.
> > > But I just want to write this data into a file. In doPost() methos I write
> > >
> > > String xmax=request.getParameter("xmax"); //xmax is name of the form entry
> > > String sample=request.getParameter("sample");//sample is name of the form
> > > //entry.input type is text.
> > > DataOutputStream dout=new DataOutputStream(new
> > > FileOutputStream("out.txt"));
> > >
> > > dout.writeBytes(xmax);
> > > dout.writeBytes(sample);
> > > dout.flush();
> > > dout.close();
> > >
> > > when I use this code in doPost() method, it does not write data to
> > > "out.txt" even it does not create it.
> > > How can I solve this problem?
> > > I really need help. thanks
> > >
> > > PS: I need some online tutorials about servlets, I could just find a few.
> > > Do you recommend an URL ?
> > >
> > > ___________________________________________________________________________
> > > 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
> >
> > --
> > **************************************************
> > Ugur KARAKAYA
> > NOUS Bilgisayar Sistemleri A.S.
> > NOUS Computer Systems Co.
> > http://www.nous.com.tr/
> > Unite for Java -> http://www.javalobby.org
> > **************************************************
> >
> >
>
> ___________________________________________________________________________
> 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