这是我的代码,这里返回类型是列表,但列表转换为数组,返回类型更改为字符串
@RequestMapping(value =Array( "/StandardChange.html"))
@ResponseBody
def findDivisionOfStandards(@RequestParam divisionid:Long):List[Division] ={
var division:List[Division]= null
if (divisionid != null) {
division = divisionService.findDivisionByStandardId(divisionid)
}
division
}
我试过了,但这不起作用
返回类型更改列表更改为字符串,值更改为列表更改为 Json数组
@RequestMapping(value =Array( "/StandardChange.html"))
@ResponseBody
def findDivisionOfStandards(@RequestParam divisionid:Long):String ={
var division:List[Division]= null
if (divisionid != null) {
division = divisionService.findDivisionByStandardId(divisionid)
}
var divisionjsonArray= division.toArray **json convert should be here**
divisionjsonArray
}
答案 0 :(得分:2)
compact(render(decompose(division)))