此处数据存储区查询工作正常
<%
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Query query = new Query("EventsDetail");
%>
这里是选择选项表单
<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>
这里,我根据选择选项
添加了过滤查询<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>
错误表明教育,艺术,娱乐无法解决。
答案 0 :(得分:1)
您的教育,艺术和娱乐代码中没有变量。你应该使用:
<% query.addFilter("Category", FilterOperator.EQUAL, "Educational"); %>
如果将属性“Category”设置为字符串值“Educational”。