0

这是我的控制器方法,我在其中设置 treeView 属性,现在我想在 jsp 中将其显示为 treeview

@RequestMapping(value = "/main.html", method = RequestMethod.GET)
public ModelAndView showMainMenu(Model model, HttpServletRequest request){

TreeViewMenuDAO tvmDao=new TreeViewMenuDAO();
    List<TreeView> list=new ArrayList<TreeView>();
    List<Object> treeView=tvmDao.getDetailsList("1","92");

    Object[] arr = new Object[5];
    for(int j=0;j<treeView.size();j++)
    {
        arr = (Object[])treeView.get(j);
        TreeView treeObj =new TreeView();
        for (int i = 0; i < arr.length; i++) {  
            switch(i){
            case 0:treeObj.setLevel((BigDecimal)arr[i]);break;
            case 1:treeObj.setProgName((String)arr[i]);break;
            case 2:treeObj.setProgCd((BigDecimal)arr[i]);break;
            case 3:treeObj.setParentCd((BigDecimal)arr[i]);break;
            case 4:treeObj.setRownum((BigDecimal)arr[i]);break;
            }
        }
        list.add(treeObj);
    }
    model.addAttribute("treeViewList", list);
    return new ModelAndView("userHome");    

}

如何在jsp中将该列表显示为dynaTree

并列出我得到的值为 level、title、titleId、parentId 和 value 是假设 level、title、titleId、parentId

1 印度 1 0

2 MH 2 1

3 孟买 13 2

4 升 3 1

5 诺伊达 12 3

4

0 回答 0