2

要过滤多个参数,我使用此 Web 服务调用:

http://mysite/sites/test/_vti_bin/listdata.svc/Values?$filter=param1%20eq%20'test1'%20and%20param2%20eq%20'test2'

但是我怎样才能以编程方式使用这个过滤器呢?

要调用 Web 服务并在 Java 中传递过滤器名称和值,我使用:

Map<String, String> variables = new HashMap<String, String>();
variables.put("filterName", "param1");
variables.put("filterValue", "test1");

然后调用:

readOnlyRestTemplate.getForObject(url, String, variables);

这适用于过滤一个参数。但是如何根据多个参数进行过滤,在此示例中包括名称/值对 'param2/test2' ?

4

0 回答 0