0

这是我的代码,这里的返回类型是列表,但列表转换为数组,返回类型更改为字符串

    @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  
    }

我试过了,但这不起作用

返回类型将List更改为String并将值更改为ListJson Array

  @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
    }
4

1 回答 1

2
compact(render(decompose(division)))
于 2013-09-13T07:33:07.153 回答