I am trying to implement a simple dynamic dropdown menu in JSP.I am using MONGODB.Here is my code.But I am getting
<select name="village" id="village">
<option value="0">Select Village</option>
<%
BasicDBObject adminQuery = new BasicDBObject();
DBCursor cursor = villages.find(adminQuery);
while(cursor.hasNext()){
%>
<option value="<%= cursor.next().get("Village").toString()%>">
<%= cursor.next().get("Village").toString()%>
</option>
<% } %>
</select>
But I am getting following exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /home.jsp at line 116
113:
114: %>
115: <option value="<%= cursor.next().get("Village").toString()%>">
116: <%= cursor.next().get("Village").toString()%>
117: </option>
118: <% } %>
119: </select>
I don't know where is the problem.Please Help me