To programmatically submit the form with java, you don't directly fill the form, rather send the form information to the submit page via HTTP GET or POST. You did not provide the onsubmit value in your post, but you would use that webpage URL and send the form information via a URLConnection. If using GET, you send the data in a query string (where key/value are the form parameters):
URL url = new URL("http://mywebsite/form-submit-webpage.php?key1=value1&key2=value2");
If POST, you must use the OutputStream of URL connection to set the POST key/value pairs
URL url = new URL("http://mywebsite/form-submit-webpage.php");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
//write key value pairs to os.
From their, get get the InputStream from the URLConnection to read the results. See https://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html