Reputation: 31
here the datastore query which work fine
<%
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Query query = new Query("EventsDetail");
%>
here the select option form
<form action="EventsPortal.jsp" method="get" id="select-cat" >
<select name="scategory" onchange="this.form.submit();">
<option>Select Category</option>
<option>Educational</option>
<option>Arts</option>
<option>Party and Entertainment</option>
</select
</form>
here, i added filter query according to the select option
<c:choose>
<c:when test="${param.scategory == 'Educational'}">
<% query.addFilter("Category", FilterOperator.EQUAL,Educational); %>
</c:when>
<c:when test="${param.scategory == 'Arts'}">
<% query.addFilter("Category", FilterOperator.EQUAL,Arts); %>
</c:when>
<c:when test="${param.scategory == 'Party and Entertainment'}">
<% query.addFilter("Category", FilterOperator.EQUAL,Entertainment); %>
</c:when>
<c:otherwise>
<h2>Latest Events</h2>
</c:otherwise>
</c:choose>
the error shows that Educational, Arts, Entertainment cannot be resolved.
Upvotes: 0
Views: 191
Reputation: 41089
There are no variables in your code for Educational, Arts, and Entertainment. You should use:
<% query.addFilter("Category", FilterOperator.EQUAL, "Educational"); %>
if you set the property "Category" to a String value "Educational".
Upvotes: 1