I've used JavaScript in my JSP page to process get data of the div tag:
var script = ace.edit("editor");
var myDivText = script.getValue();
Now I want to pass myDivText to my servlet.java
. Till today I've passed it as below
window.open('http://XXX.XX.XXX.XX:8800/FirstServlet/mygeco?mytxt=' + myDivText,'resizable=yes');
But now, I had to include a few input forms and now I am calling my servlet through a submit mechanism, so how do I pass myDivText to servlet.java without using the above method?
==============================EDIT==========================
My form looks as follows:
<form method="post" name="myform" action="upload" target="_top" enctype="multipart/form-data">
<li>Left File : <input type="file" name="dataFile1" id="fileChooser1" /></li>
<li>Right File : <input type="file" name="dataFile2" id="fileChooser2" /></li>
<li>Config File :<input type="file" name="dataFile3" id="fileChooser3" /></li>
<li><input type="hidden" name="myField" id="myfield" value="" /></li>
</form>
Submitting form through JavaScript:
var scc1 = document.getElementById("box");
scc1.innerHTML = scc1.innerHTML + "<br>" + "<span class='blue'>Uploading files, the page might refresh</span>";
var thetxt = scc1.innerHTML;
document.getElementById('myField').value = thetxt;
document.myform.submit();
Getting data in Servlet.java
String mydiv = request.getParameter("myField");
request.setAttribute("mydiv", mydiv);