This is just to give you a reference how you can update the code and used the scriptlet result --
<%
String hiddenResult = "";
// DO your business logic here and assign value to the hiddenResult
<% for(int k=0;k<listDate.size();k++){%>
hiddenResult = hiddenResult + listDate.get(k)+",";
hiddenResult = hiddenResult.substring(0,hiddenResult.length()-1);
%>
Assign the scriptlet result in the hidden field of the form and use that hidden field like this
<input type="hidden" id="hiddenInputResult" name="hiddenDDResult" value="<%=hiddenResult%>" />
<!--assign the value here in hidden field -->
function myFunction(){
var arrayValue = document.getElementById("hiddenInputResult").value;
// you can split by using arrayValue.split(","); to use
}