神啊,救救我吧
1,java:
public String execute() throws Exception {
String str ="[{\"id\":\"0\",\"text\":\"java\"}]";
JSONArray data = JSONArray.fromObject(str); hava set ,get method
System.err.println("22combo json data=»"+data);print out:[{"id":"0","text":"java"}]
return SUCCESS;
}
2,jsp:
<script>
json file:[{"id":"1", "text":"Java"}]
var comboBoxURL3 = 'http://localhost:8082/struct2/comboboxData.action';
java class:[{"id":"0","text":"java"}]
var comboBoxURL = 'http://localhost:8082/struct2/TSComboJson.action';
$('#DCombox12').combobox({url: comboBoxURL, valueField:'id', textField:'text' });
//combobox use comboBoxURL is not show data, but comboBoxURL3 is ok
$.post(comboBoxURL,{
},
function(theback){
alert('theback.data[0].text='+theback.data[0].text); //print out: theback.data[0].text=java
},
"json"
);
combobox json 多了一层怎么办