private void constituteTopic(int _topicid) { try { this.topic = bm.loadTopicWithCommentsByTopicId(_topicid); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } User u = new User(); try { u = um.loadUserByid(this.topic.getAuther()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } this.topic.setUser(u); for (Comment comm : this.topic.getComments()) { User cu = new User(); try { cu = um.loadUserByid(comm.getAuther()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } comm.setUser(cu); System.out.println("cu---" + cu.toString()); System.out.println("Comm---" + comm.toString()); System.out.println("Commuser---" + comm.getUser().toString()); } }
public String addUser() { this.user = new User(); this.user.setUsername(username); this.user.setPassword(password); if (this.userid != null && this.userid.length() > 0 || this.request.getParameter("userid") != null && this.request.getParameter("userid").length() > 0) { this.user.setId(Integer.parseInt(this.userid)); try { um.update(this.user); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } else { try { um.add(user); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } return "add"; }
private void buildUsersListByTradeid(int _tradeid) { this.userslist = new ArrayList<User>(); try { this.userslist = um.loadusersByTradeid(_tradeid); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } this.pagination(); this.partUserList(); }
public String deleteUser() { String userid = this.request.getParameter("userid"); if (userid != null) { int id = Integer.parseInt(userid); try { um.delete(id); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } return "delete"; }
public List<MemberCenterColumn> selectMcclist() { this.mcclist = new ArrayList<MemberCenterColumn>(); try { this.mcclist = um.loadMemberCenterColumns(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } if (this.mcclist.size() > 0) { for (MemberCenterColumn mcc : this.mcclist) System.out.println("mcc---->" + mcc.toString()); } else System.out.println("loadMemberCenterColumns DATA ERROR, pls INV..."); return this.mcclist; }
public String updateMcc() { this.memberCenterColumn = new MemberCenterColumn(); System.out.println("input colid----->" + this.columnid); System.out.println("input colname--->" + this.columnname); if (this.columnid != null && this.columnid.length() > 0) this.memberCenterColumn.setId(Integer.parseInt(this.columnid)); if (this.columnname != null && this.columnname.length() > 0) this.memberCenterColumn.setName(this.columnname); try { um.updateMemberCenterColumn(this.memberCenterColumn); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } this.selectMcclist(); return "update"; }