【发布时间】:2016-01-28 12:24:17
【问题描述】:
我有一个json结构如下: [{"text":"US","value":"United Sates"},{"text":"CA","value":"Canada"}]
我创建了一个 servlet 来将下拉列表填充到组件中。 我的小服务程序:
while (node.hasNext()) {
Node child = node.nextNode();
if (child.hasProperty("nationcode") && child.hasProperty("nationname")) {
JSONObject json = new JSONObject();
json.put("text", child.getProperty("nationcode").getValue().getString());
json.put("value", child.getProperty("nationname").getValue().getString());
jsonArray.put(json);
}
}
response.setContentType("application/json"); response.getWriter().write(jsonArray.toString());
我的组件有 options="bin/"
我尝试仅填充值,但它只能填充下拉列表中的“文本”。如何确保我的组件下拉列表仅填充值而不填充键(文本)?
【问题讨论】:
标签: content-management-system aem