Write to a website using java : <p>I am currently working on reading and writing to a website, only using Java. I have figured out how to read from the website, to get all the content on the actual website. But I am not completely sure where to begin with the writing, although it seems as if it is a simple action I want to do. I just want to write a specific string to a text area on a website.</p>

<p>To show the code I have for reading the site, I have attached it below. </p>

<pre><code>import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;

import org.apache.commons.io.IOUtils;

public class Read {

    public static void main(String[] args) throws IOException {

        URL url = new URL("http://website.com/");
        URLConnection con = url.openConnection();
        InputStream in = con.getInputStream();
        String encoding = con.getContentEncoding();
        encoding = encoding == null ? "UTF-8" : encoding;
        String body = IOUtils.toString(in, encoding);
        System.out.println(body);

        PrintWriter pToDocu = new PrintWriter("readText.txt");
        pToDocu.println(body);
        pToDocu.close();

    }

}
</code></pre>

<p>Now what I am trying to achieve is how to write the content of a string variable to a text area of which is on a website I have created. It is probably also pretty important to note that, for the info in the text area to be submitted a button called <em>submit</em> on the site has to be clicked. </p>
