1.String str = null;
  if (str == null) 
    System.out.println("str is null");
2.我的办法比较笨
    Connection conn = ...//get Connection
    PreparedStatement psm = null;
    ResultSet rs = null;
    int totalRowNumber = 0;
    try {
      psm = conn.prepareStatement(sql);
      rs = psm.executeQuery();
      while (rs.next()) {
        totalRowNumber++;
      }
    } catch (SQLException sqlx) {
      System.out.println("Got SQLException : " +sqlx.toString());
    }
    System.out.println("total result number : " +totalRowNumber);
3.三本很不错的jsp书
《jsp web编程指南》
《jsp编程指南》
《jsp站点设计编程指南》