第一步
第二步
<body>
<button value="點擊彈出樹的dialog對話框" onclick ="getTree()"/>
<div id="ztree" class="ztree"/>
</body>
<script type="text/javascript">
function getTree(){
var url = "<c:url value=
var setting={
};
var zNodes =[];
var option={
width:
hight:
};
$
url : url
success : function(data){
$
zNode
id:d
name:d
pId:d
})
});
$
$(
}
})
}
</script>
第三步
@RequestMapping("/zone_ajaxtree")
@ResponseBody
public List<ZoneBody> zone_ajaxtree() {
List<ZoneBody> zones = zoneBodyService
return zones;
}
因為要用到@ResponseBody
<bean
class="org
<property name="webBindingInitializer">
<bean class="com
</property>
<property name="messageConverters">
<ref bean="jsonHttpMessageConverter" />//這裡為@responseBody提供json的支持
</property>
</bean>
<bean id="jsonHttpMessageConverter"
class="org
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20453.html