title: Dependent Drop Down List in jsp
body: <p>I am having two dropdown in my JSP. One is for topcategories and the other is for subCategories. When my JSP page initially loads it will contain only the topcategories list in first drop down box and the second drop down will be empty. When I select topcategory from first dropdown its corresponding subcategories should be populated in the second dropdown. During my initial load of jsp itself I will get the databean which conists of both topcategory and subcategory list. So when the topcategory is selected  i should get the value of topcategory selected and I have to compare it with the topcategory list present in databean and need to populate the corresponding subcategories in the second drop down. How to do this plz help me. Thanks in advance. I have shared my code for reference.</p>
  
  <pre><code>&lt;div class="selectbox01"&gt;
                  &lt;select name="make" id="make" onchange="loadModel()"&gt;
  
                      &lt;c:forEach var="topCategory" items="${catalog.topCategories}" varStatus="status"&gt;
                      &lt;option selected="selected"&gt;&lt;/option&gt;
                      &lt;option value="${topCategory.categoryId}"&gt;&lt;c:out value="${topCategory.description.name}"/&gt;&lt;/option&gt;
                      &lt;/c:forEach&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;c:set var="make" value="${WCParam.make}"/&gt;
              &lt;div class="selectbox01"&gt;
                  &lt;select name="model" id="model"&gt;
                  &lt;option selected="selected"&gt;&lt;/option&gt;
                  &lt;c:forEach var="topCategory" items="${catalog.topCategories}" varStatus="status"&gt;
                  &lt;c:if test="${topCategory.categoryId == make}"&gt;
                  &lt;c:forEach var="subTopCategory" items="${topCategory.subCategories}" varStatus="status2"&gt; 
                      &lt;option value="${subTopCategory.categoryId}"&gt;
  &lt;c:out value="${subTopCategory.description.name}"/&gt;&lt;/option&gt;
                     &lt;/c:forEach&gt;
                     &lt;/c:if&gt;
                       &lt;/c:forEach&gt;
  
                  &lt;/select&gt;
              &lt;/div&gt;
  </code></pre>