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

Reply via email to