spring+srpingmvc+hibernate实现动态ztree生成树状图效果
ztree生成树状图
仁布网站建设公司创新互联公司,仁布网站设计制作,有大型网站制作公司丰富经验。已为仁布成百上千家提供企业网站建设服务。企业网站搭建\成都外贸网站建设要多少钱,请找那个售后服务好的仁布做网站的公司定做!
ztree官网
前台
导入js和css包
下载地址
前端页面 ztree.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" isELIgnored="false" %>ztree
后台
ztree所需实体类
package com.shp.dev.common; public class Ztree { private String id; private String pId; private String name; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getpId() { return pId; } public void setpId(String pId) { this.pId = pId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Ztree() { } public Ztree(String id, String pId, String name) { this.id = id; this.pId = pId; this.name = name; } @Override public String toString() { return "Ztree{" + "id='" + id + '\'' + ", pId='" + pId + '\'' + ", name='" + name + '\'' + '}'; } }
dao接口
package com.shp.dev.menu.dao; import com.shp.dev.menu.pojo.Menu; import java.util.List; public interface MenuDao { List
dao的实现类
package com.shp.dev.menu.dao; import com.shp.dev.menu.pojo.Menu; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.util.List; @Repository("menuDao") public class MenuDaoImpl implements MenuDao{ @Autowired private SessionFactory sessionFactory; @Override public List
业务接口
package com.shp.dev.menu.service; import com.shp.dev.menu.pojo.Menu; import java.util.List; public interface MenuService { List
业务实现层
package com.shp.dev.menu.service; import com.shp.dev.menu.dao.MenuDao; import com.shp.dev.menu.pojo.Menu; import com.shp.dev.role.dao.RoleDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service("menuService") public class MenuServiceImpl implements MenuService{ //@Transactional(readOnly = true)//只读事务 // @Transactional(rollbackFor = Exception.class)//启动事务,所有异常都回滚 @Autowired private MenuDao menuDao; @Override @Transactional(readOnly = true)//只读事务 public List
控制层
package com.shp.dev.menu.web; import com.shp.dev.common.Ztree; import com.shp.dev.menu.pojo.Menu; import com.shp.dev.menu.service.MenuService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.ArrayList; import java.util.List; @Controller @RequestMapping("/menu") public class MenuController { @Autowired private MenuService menuService; @RequestMapping("/findZtree") @ResponseBody // 返回json对象 public ListfindZtree(){ List menus=new ArrayList (); List
总结
以上所述是小编给大家介绍的spring+srpingmvc+hibernate实现动态ztree生成树状图,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对创新互联网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
本文标题:spring+srpingmvc+hibernate实现动态ztree生成树状图效果
路径分享:http://azwzsj.com/article/psspsg.html