Skip to main content

pass data from a java textbox into an html page

1 reply [Last post]
Joined: 2006-08-01

Hi there,

Is there anyone to know how to pass data from a java textbox into an html file...
If there is a library from java?

Thanks a lot.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-08-07

You mean to convert java textbox content to html
format and save it as a page?

Get the text from the box and format the result as an html file:
// assuming JTextArea textBox=new JTextArea();

// fetch the text from the box

String myString=textBox.getText();
String path="out.html";

// format as an html page

String htmlPage=" \n"
+" \n"
+ myString
+" \n"

// try to save to file

try{ // in case i/o exception occurs

FileWriter writer=new FileWriter(path);
char[] arr=htmlPage.toCharArray();

catch(IOException ex){ // something went wrong...

System.out.println("couldn't write file");


}finally{ // whatever happened, make sure we close the
// stream



Or did I get the question completely wrong?