Examples of BeanListHandler


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

    List list = null;
    User user = null;
    // 获取用户信息
    try {
      list = (List) qr
          .query(sql, new BeanListHandler(User.class), params);
    } catch (SQLException e) {
      e.printStackTrace();
    }
    // 判断是否合法用户 并把User对象放入Session中
    if (list.size() > 0) {
View Full Code Here

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

  @SuppressWarnings("rawtypes")
  public static <T> List<T> query(Class<T> beanClass, String sql,
      Object... params) throws SQLException {
      return (List<T>) _runner.query(getConnection(), sql,
                _IsPrimitive(beanClass) ? _columnListHandler
                        : new BeanListHandler(beanClass), params);
  }
View Full Code Here

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

     * Utils methods for map results of queries to customized beans or java.Util.Map
     **/
   
  @SuppressWarnings("unchecked")
  public List findListOfBeans(String sql, Object[] filterKeys, Class beanClass) { 
        return (List) executeQuery(sql, filterKeys, new BeanListHandler(beanClass));
    }
View Full Code Here

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

            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

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

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

            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

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

                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

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

        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

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

        + 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

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

    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
Copyright © 2018 www.massapi.com. 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.