如何回复评论(论坛页面风格)

i7uaboj4  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(236)

我有一个java项目,在这个项目中,我必须让用户在论坛页面上发表评论,并让用户回复评论。我不知道如何将回复与某个评论联系起来。这是我的代码和我到目前为止的想法(我必须使用mysql表)https://i.stack.imgur.com/ivsdt.png(我的评论部分):

<%
     Statement statement2; 

     statement2 = connection.getConnection().createStatement();   
     ResultSet rs2;
     int counter = 0;

     try {

          rs2 = statement.executeQuery("SELECT Comment FROM CommentInfo WHERE Topic = '" + session.getAttribute("addPage") + "'");
          while(rs2.next()) {

               out.println("<tr>");
               out.println("<td style='background-color:white'>" + rs2.getString("Comment") + "</td>");
               out.println("<tr>");                                          
               out.println("<form action = 'ProcessReplies.jsp' method = 'post'>");
               out.println("<td> <input type='text' id ='Reply' name='Reply'> <button type='submit'>Reply</button>");
               out.println("</form>");
               out.println("</tr>");
               out.println("</tr>");

          }

        //  out.println(counter);

        } catch(SQLException sqle){
            throw new Exception("SQLException" + sqle);
        }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题