I have an object that has a few different string and string array properties. I want to build a cascading dropdown list from these (I'm using the Springs SimpleFormController to fill these in the referenceData() method)
SearchFieldName object
public class SearchFieldName {
private String name;
private String display;
private String type;
private String[] operators;
private String[] values;
private String[] displayValues;
public ArrayList<SearchFieldName> searchFieldList;
SimpleFormController
//searchFieldList is a collection of SearchFieldName's
//selectedFieldName is one particular instance of SearchFieldName.getName()
Map<String, Object> refData = new HashMap<String, Object>();
refData.put("searchFields", searchFieldList);
refData.put("selectedFieldName", selectedFieldName);
the jsp:
<c:set var="count" value="-1" />
<c:forEach var="selectedField" items="${selectedFieldName}">
<c:set var="count" value="${count + 1}"></c:set>
<!-- Field types -->
<select name="fields_${count}" id="additional_search_field_${count}">
<c:forEach var="fieldItem" items="${searchFields}">
<c:choose>
<c:when test="${selectedField == fieldItem.name}">
<option value="${fieldItem.name}" selected="selected">${fieldItem.display}</option>
</c:when>
<c:otherwise>
<option value="${fieldItem.name}">${fieldItem.display}</option>
</c:otherwise>
</c:choose>
</c:forEach>
</select>
<!-- Operators -->
<c:forEach var="fieldItem" items="${searchFields}">
<c:choose>
<c:when test= ??? fields_${count}.selected = fieldItem ??? >
<select name="operators_${count}" id="additional_search_operator_${count}">
<c:forEach var="operator" items="${fieldItem.operators}">
<option value="${operator}">${operator}</option>
</c:forEach>
</select>
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
</c:forEach>
</c:forEach>
the problem is currently with the line
<c:when test= ??? fields_${count}.selected = fieldItem ??? >
I don't know how to set up the syntax for that if - this is where i could benefit from some client side process to handle the cascading part
(I'll be honest, I didn't do a thurough search for this problem yet - I'll do that now just to be sure)