I had searched all other questions but that doesnt solved my problem so i asked that again with the hope to solve this issue.
I want to pass a Servlet-generated Hashmap to a JSP generated page. On this page, the user selects a particular value of the first dropdown, which populates the contents of second dropdown. The keys of the Map are options for the first list, and the values for the second list.
I tried to create the Map in the script and iterate over it using jstl to create a new Map, unsuccessfully.
Here is my jquery code where i am setting:
$(document).ready(function() {
//#year is the id of firstdropdown list
$( "#year" ).change(function() {
var operationFields = {};
operationFields= populateArray();
function populateArray(){
<c:forEach var="entry" items="${requestScope.hmfillweekrange}">
operationFields['${entry.key}']:'${entry.value}';
</c:forEach>
alert("........."+operationFields);
return operationFields;
};
Here is a part of my jsp showing code for dropdowns:
On selecting a year the week range should change:
<td><select name="year" id="year">
<c:forEach var="year" items="${arrYear}">
<option>${year}</option>
</c:forEach>
</select></td>
<td class="tdmain MakeBold">Week</td>
<td><select name="weekRange" id="wRange" >
<c:forEach var="week" items="${arrWeeks}">
<option>${week}</option>
</c:forEach>
</select></td>