第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

關(guān)于回復(fù),留言功能的問題,能幫忙看看哪里錯(cuò)了么?

關(guān)于回復(fù),留言功能的問題,能幫忙看看哪里錯(cuò)了么?

慕工程6005648 2017-03-16 17:04:53
message.jsp<%@ page language="java" contentType="text/html; charset=UTF-8"? ? pageEncoding="UTF-8" import="java.sql.*"%>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?<!-- 用于顯示留言 --><form name="form3" method="post" action="msgs.jsp"><textarea name="text2" rows="8" cols="40" ></textarea><br><input type="reset" ?value="清空">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp?<input type="submit" value="發(fā)表" ?><!-- <br>請輸入你要回復(fù)的ID:<input name="id" type="text" value="回復(fù)"> --> ?</form><%?? ? /* String text=new String(request.getParameter("text2").getBytes("ISO-8859-1"),"UTF-8"); ?*/? ? /* session.setAttribute("text2",text); */? ? ?String name7=(String)session.getAttribute("visitorName");?? ? /* ?String id=new String(request.getParameter("id").getBytes("ISO-8859-1"),"UTF-8"); ?*/try {Class.forName("com.mysql.jdbc.Driver");} catch (ClassNotFoundException e) {System.out.println("加載數(shù)據(jù)庫驅(qū)動(dòng)時(shí)拋出異常,內(nèi)容如下:");?e.printStackTrace();} ?? Connection conn4 = DriverManager.getConnection("jdbc:mysql://localhost:3306/visitor","root","123456");? Statement stmt4=conn4.createStatement();? Statement stmt5=conn4.createStatement();? ResultSet rs6=stmt4.executeQuery("select * from message ");? ResultSet rs7=stmt5.executeQuery("select * from replyed ");??? while(rs6.next()){ ?out.println("id:"+rs6.getString(1)+"用戶"+rs6.getString(2)+"留言內(nèi)容:"+rs6.getString(3)+"日期"+rs6.getString(4)); ?out.println("<br>"); ?out.println("<form action='reply.jsp' method='post'>"); ?out.println("<textarea name='text3' rows='3' cols='40'>"); ?out.println("</textarea>"); ?out.println("<br>"); ?out.println("<input name='replyName' type='hidden' value='rs6.getString(1)'> "); ?out.println("<input type='reset' value='清空'> "); ?out.println("<input type='submit' value='回復(fù)'> "); ?out.println("</form>"); ?while(rs7.next()){ ?out.println("<br>"); ?out.println("id:"+rs7.getString(1)+"用戶"+rs7.getString(2)+"回復(fù)內(nèi)容:"+rs7.getString(3)+"日期"+rs7.getString(4)+"回復(fù)ID"+rs7.getString(5));? } ?? }? stmt4.close();? stmt5.close();? conn4.close();? rs6.close();%>msgs.jsp<%@ page language="java" contentType="text/html; charset=UTF-8"? ? pageEncoding="UTF-8" import="java.sql.*"%>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <!-- ?將留言存入數(shù)據(jù)庫并返回message.jsp顯示 -->? ??<%?? ? String text=new String(request.getParameter("text2").getBytes("ISO-8859-1"),"UTF-8");? ? String name7=(String)session.getAttribute("visitorName");? ??? ??? ? /* String text3=(String)session.getAttribute("text2"); */try {Class.forName("com.mysql.jdbc.Driver");} catch (ClassNotFoundException e) {System.out.println("加載數(shù)據(jù)庫驅(qū)動(dòng)時(shí)拋出異常,內(nèi)容如下:");?e.printStackTrace();} ?Connection conn4 = DriverManager.getConnection("jdbc:mysql://localhost:3306/visitor","root","123456");? Statement stmt4=conn4.createStatement();? int rs5=stmt4.executeUpdate("insert into message(name,text)values('"+name7+"','"+text+"')");????? /* ResultSet rs6=stmt4.executeQuery("select * from message where name='"+name7+"' ");????? while(rs6.next()){ ?out.println("id:"+rs6.getString(1)+"用戶"+rs6.getString(2)+"留言內(nèi)容:"+rs6.getString(3)+"日期"+rs6.getString(4)); ?out.println("<br>");? } */???? stmt4.close();? conn4.close();? /* rs6.close(); */%>? ?<jsp:forward page="message.jsp"/>?reply.jsp<%@ page language="java" contentType="text/html; charset=UTF-8"? ? pageEncoding="UTF-8" import="java.sql.*" %>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <!-- ?將回復(fù)存入數(shù)據(jù)庫,并返回message.jsp中顯示 --><% ??? ? String name7=(String)session.getAttribute("visitorName");? ? String replyId=new String(request.getParameter("replyName").getBytes("ISO-8859-1"),"UTF-8");? ? String replyText=new String(request.getParameter("text3").getBytes("ISO-8859-1"),"UTF-8");?? ? try {? ? Class.forName("com.mysql.jdbc.Driver");? ? } catch (ClassNotFoundException e) {? ? System.out.println("加載數(shù)據(jù)庫驅(qū)動(dòng)時(shí)拋出異常,內(nèi)容如下:");?? ? e.printStackTrace();? ? } ?? ? ? ? Connection conn7 = DriverManager.getConnection("jdbc:mysql://localhost:3306/visitor","root","123456");? ? Statement stmt7=conn7.createStatement();? ? int rs7=stmt7.executeUpdate("insert into replyed(name,message,replyId)values('"+name7+"','"+replyText+"','"+replyId+"')");? ? stmt7.close();? ? conn7.close();%><jsp:forward page="message.jsp"/>?//////session.setAttribute("visitorName",name6);/////上邊的visitorName是從這里來的,在用戶登陸的時(shí)候提取用戶的name6這個(gè)參數(shù)這個(gè)問題卡了我兩天了,自己一個(gè)人想想不出來,,厚著臉皮看看有沒有人能幫我看看該怎么改,謝謝了
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關(guān)注
  • 1187 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號