Package org.apache.commons.dbutils.handlers

Examples of org.apache.commons.dbutils.handlers.BeanListHandler


                        + id;
                String categorySql = "select category_id as id,category_name as name,category_level as level from category";
                QueryRunner qr = DbHelper.getQueryRunner();

                // 分别从两张表中读取数据 分类表中用于下拉菜单
                List blogList = (List) qr.query(blogSql, new BeanListHandler(
                        Blog.class));
                List categoryList = (List) qr.query(categorySql,
                        new BeanListHandler(Category.class));
                Blog blog = (Blog) blogList.get(0);

                request.setAttribute("blog", blog);
                request.setAttribute("list", categoryList);
                request.getRequestDispatcher("/admin/editBlog.jsp").forward(
View Full Code Here


            String categorySql = "select category_id as id,category_name as name from category order by category_level,category_id desc";
            String commentSql = "select comment_id as id,comment_username as username,comment_content as content,comment_created_time as createdTime from comment";
            // DBUTIL的核心类 生成对象时 传递数据源对象
            QueryRunner qr = DbHelper.getQueryRunner();
            // 使用BeanList构建对象List
            List blogList = (List) qr.query(blogSql, new BeanListHandler(
                    Blog.class));
            List categoryList = (List) qr.query(categorySql,
                    new BeanListHandler(Category.class));
            List commentList = (List) qr.query(commentSql, new BeanListHandler(
                    Comment.class));
            // 向JSP页面发送对象list
            request.setAttribute("blogList", blogList);
            request.setAttribute("categoryList", categoryList);
            request.setAttribute("commentList", commentList);
View Full Code Here

                String sql = "select blog_id as id ,blog_title as title,blog_content as content ,blog_created_time as createdTime from blog order by blog_id desc";

                QueryRunner qr = DbHelper.getQueryRunner();
                // 使用BeanList构建对象List
                List list = (List) qr.query(sql,
                        new BeanListHandler(Blog.class));

                // 向JSP页面发送对象list

                request.setAttribute("list", list);
                request.getRequestDispatcher("/admin/adminBlogList.jsp").forward(request, response);
View Full Code Here

        List commentsList = null;
        List categoryList = null;
        try {

            // 使用BeanList构建对象List 存放一个博文信息
            blogContent = (List) qr.query(blogSql, new BeanListHandler(Blog.class));
            blog = (Blog) blogContent.get(0);

            blogList = (List) qr.query(blogListSql, new BeanListHandler(
                    Blog.class));
            commentList = (List) qr.query(commentSql, new BeanListHandler(
                    Comment.class));
            commentsList = (List) qr.query(commentsSql, new BeanListHandler(
                    Comment.class));
            categoryList = (List) qr.query(categorySql, new BeanListHandler(
                    Category.class));
        } catch (SQLException e) {
            e.printStackTrace();
        }
View Full Code Here

        + id;
    QueryRunner qr = DbHelper.getQueryRunner();
    Category category = null;
    try {
      List list = (List) qr.query(sql,
          new BeanListHandler(Category.class));
      category = (Category) list.get(0);
    } catch (SQLException e) {
      e.printStackTrace();
    }
    request.setAttribute("category", category);
View Full Code Here

    String sql = "select category_id as id,category_name as name,category_level as level from category order by category_level desc, category_id desc";
    QueryRunner qr = DbHelper.getQueryRunner();
    List list = null;
    try {
      list = (List) qr.query(sql, new BeanListHandler(Category.class));
    } catch (SQLException e) {

      e.printStackTrace();
    }
    request.setAttribute("list", list);
View Full Code Here

TOP

Related Classes of org.apache.commons.dbutils.handlers.BeanListHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.