codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  how to convert java to jsp  kacheek at 17:03 on Friday, April 21, 2006
 

hi. i am new to jsp programming and i'm facing some problems with the codings. i wonder how to change those java codes into jsp. is it possible to open the text file and insert it into <textarea>? thanks in advance...

void doOpenCommand () {
String curFile;
char[] data;
String fred;

FileDialog file = new FileDialog
(frame, "Open File", FileDialog.LOAD);
file.setFile ("/forum/.java.txt");
file.show();

if ((curFile = file.getFile()) != null) {
String filename = file.getDirectory() + curFile;
frame.setCursor (Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
File f = new File (filename);
try {
FileReader fin = new FileReader (f);
int filesize = (int)f.length();
data = new char[filesize];
fin.read (data, 0, filesize);
fred = new String(data);
System.out.println (fred);
pane.setText("");
pane.append (fred);
status.setText ("Loaded: " + filename);
}
catch (FileNotFoundException exc) {
status.setText ("File Not Found: " + filename);
} catch (IOException exc) {
status.setText ("IOException: " + filename);
}
}
}

void doSaveCommand(){
String curFile;
char[] data;

FileDialog file = new FileDialog
(frame, "Save File", FileDialog.SAVE);
file.show() ;

if ((curFile = file.getFile()) != null) {
String filename = file.getDirectory() + curFile+ "1";
File f = new File (filename);
try {
FileWriter fw = new FileWriter (f);
String text = pane.getText();
int textsize = text.length();
fw.write(text,0,textsize);
fw.close();
status.setText ("Saved: " + filename);
} catch (IOException exc) {
status.setText ("IOException: " + filename);
}
}
}









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: array names
•  Let`s see what ya got - cascading menus in include - visibility dependent on page
•  Re: Query on onLoad
•  i want to execute an url using javascript
•  Re: Connecting MS Access Database in ASP.net - C#
•  Re: Conversion
•  Re: tester class and then some.
•  Re: Game - illegal combination of modifiers
•  Using Selection sort for a linked list


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006