I'm doing something like that with a file I have open now. You could
do this in the actual jsp page where the form is submitted to or you
could have this in a java bean. In this case I have a vector that
stores PhoneInfo objects and i read the data from there. I posted
what I think you want after the top example.
try
{
File f = new File("some full path to your file.txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(
f.getPath(), false ));
Iterator iter = information.iterator();
while( iter.hasNext() )
{
pi = (PhoneInfo)iter.next();
bw.write(pi.getFirstName()+"\t"+pi.getLastName()+"\t"+pi.getNumberOne(
)+"\t"+pi.getOther()+"\t"+pi.getEmail()+"\n");
}
bw.close();
}
catch(IOException e)
{
System.out.print("Error writing file "+e );
}
Yours might look something like this...
try
{
File f = new File("some full path to your file.txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(
f.getPath(), false ));
bw.write(
request.getParameter("firstName")+"\t"+request.getParameter("lastName"
) +"\t"+ etc etc);
bw.close();
}
catch(IOException e)
{
System.out.print("Error writing file "+e );
}
On 15 Aug 2000, at 13:48, Philip Moschovas wrote:
> I have been working with ASP and I am new to JSP. I've used the
> filesystemobject in VBscript to create files, write to files etc. I
> was wondering if there is a way with JSP to use the contents of a
> submitted form and write them to a text file.
>
> Thanks in Advance,
> Philip
>
> ======================================================================
> ===== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets