|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Hello, I am extremely new to java and I just need some basic advice. My company develops statistical models that read from text files. I want
a)people to be able to go to my site enter values into a form and pass those values to a text file. b)execute the model (nothing special just like calling a regular .exe) c)display the results from a text file (the model writes to a text file) into the browser I understand that this is very basic stuff but I need somewhere to start. Could I have some advice? If you could point me to any articles, code, tutorials on this I would really appreciate it. Ryan |
|
#2
|
|||
|
|||
|
Servlets will handle those tasks quite easily. Youll have to import java.io.*;
For writing to a file, you could use something like FileWriter writer = new FileWriter("user/default/file.txt"); BufferedWriter doWrite = new BufferedWriter(writer); doWrite.write("Testing"); doWrite.flush(); doWrite.close(); writer.close(); For Reading use something like this FileReader reader = new FileReader("user/default/file.txt"); BufferedReader doRead BufferedReader(preader); String whatever; //Then for each line to read in use whatever=doRead.readLine(); doRead.close(); reader.close(); //Once you invoke the readLine() method the pointer automatically hops to the next line, so whatever=doRead.readLine(); will read in the next line without you having to jump to it. Do a search on google for "doGet" and "getParameter()" for handling forms. I hope this helped. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > help!!! passing info to text file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|