回复提问模块功能的实现
1.先在热门关注上选择一个问题或者市搜索关键字选择一个问题
2.再点击主题栏里的关键字进入这个问题
代码:
<body> <div id="bg" style="position:absolute; width:100%; height:100%; z-index:-1"> <img src="img/MainLog.png" height="100%" width="100%" > </div> <div> <table align="center" width="100%" border="2"> <tr background="#44ccff"> <th>编号</th> <th>评论者</th> <th>内容</th> </tr> <% String topic=new String(request.getParameter("topic").getBytes("ISO-8859-1"),"UTF-8"); String author=new String(request.getParameter("author").getBytes("ISO-8859-1"),"UTF-8"); Connection con=null; Statement stmt=null; ResultSet rs=null; int i=-1; Class.forName("com.mysql.jdbc.Driver"); String url="jdbc:mysql://localhost:3306/learning?useUnicode=true&characterEncoding=gbk"; con=DriverManager.getConnection(url,"root","root"); stmt=con.createStatement(); String query="select distinct * from `review` where author=‘"+author+"‘ and topic=‘"+topic+"‘ "; rs=stmt.executeQuery(query); while(rs.next()){ i++; if(i==0){continue;} %> <tr> <td align="center"><%=i %></td> <td><%=rs.getString("revi") %></td> <td><%=rs.getString("revcontent") %></td> </tr> <% } %> </table> </div> <br><br><br><br><br><br><br><br><br><br><br> <div id="mq" > <hr style="FILTER: alpha(opacity=100,finishopacity=5,style=5)" width="95%" color=#987cb9 size=20 > <form action="dealing/review.jsp" method="get"> 评 论 者:<input type="text" name="revi" size="20"> <p id="matter" align="left"> 内 容:</p> <textarea id="matterright" name="revcontent" rows="8" cols="70" > </textarea><br> <input type="hidden" name="author" value="<%=author %>"/> <input type="hidden" name="topic" value="<%=topic %>"/> <p id="mqp"> <input type="submit" value="提交" > <input type="reset" value="重置"> <a href="http://localhost:8080/Management/dealing/hotquestion.jsp">返回</a> </p> </form> </div> </body>
3.回复问题成功后,点击我的问题将显示回复
<body> <div id="bg" style="position:absolute; width:100%; height:100%; z-index:-1"> <img src="img/tools25.gif" height="100%" width="100%" > </div> <div id="mq" > <form action="dealing/makeQuestion.jsp" method="post"> <br> 问题类型:<%=request.getSession().getAttribute("classify") %><br><br> 留 言 者:<%=request.getSession().getAttribute("author") %><br><br> 留言标题:<%=request.getSession().getAttribute("topic") %> <p id="matter" align="left"> 内 容:</p> <textarea id="matterright" name="mainbaby" rows="8" cols="70" > <%=request.getSession().getAttribute("mainbaby") %> </textarea><br> <p id="mqp"> <input type="submit" value="返回" > </p> </form> </div> </body>
时间: 2024-10-25 12:19:02