Beispiel #1
0
  public String commentsave() {

    System.out.println("--------------commentsave-----------");
    User u = new User();
    u = (User) this.request.getSession().getAttribute("user_");
    System.out.println("User------" + u.toString());

    String content = this.binfo.getCommentcontent();
    String topicid = this.binfo.getId();
    this.comment = new Comment();
    this.comment.setContent(content);
    this.comment.setTopicid(Integer.parseInt(topicid));
    this.comment.setAuther(u.getId());
    this.comment.setUser(u);
    this.comment.setDate(CONSTANT.getNowTime());
    System.out.println("this.comment----" + this.comment.toString());
    try {
      bm.add(this.comment);
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (SQLException e) {
      e.printStackTrace();
    }

    this.constituteTopic(this.comment.getTopicid());
    this.updateTopicTime(this.comment.getTopicid(), this.comment.getDate());
    return "save";
  }
Beispiel #2
0
  public String topicbuilt() {
    System.out.println("--------------topicbuilt-----------");
    User u = new User();
    u = (User) this.request.getSession().getAttribute("user_");

    this.topic = new Topic();
    this.topic.setTitle(this.binfo.getTopictitle());
    this.topic.setContent(this.binfo.getTopiccontent());
    this.topic.setDate(CONSTANT.getNowTime());
    this.topic.setAuther(u.getId());
    this.topic.setAuthername(u.getUsername());
    this.topic.setLastupdate(this.topic.getDate());
    System.out.println("topic---------------" + this.topic.toString());
    try {
      bm.add(this.topic);
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (SQLException e) {
      e.printStackTrace();
    }
    this.alltopiclist();
    return "built";
  }