運(yùn)行后對話頁面顯示的問題
/** ?*?對話頁的初始化控制??InitTalkServlet.java ?*/ @SuppressWarnings("serial") public?class?InitTalkServlet?extends?HttpServlet?{ ????@Override ????public?void?doGet(HttpServletRequest?req,?HttpServletResponse?resp) ????????????throws?ServletException,?IOException?{ ????????//設(shè)置編碼 ????????req.setCharacterEncoding("utf-8"); ????????//頁面跳轉(zhuǎn) ????????req.getRequestDispatcher("/WEB-INF/jsp/front/talk.jsp").forward(req,?resp); ????} ? ????@Override ????protected?void?doPost(HttpServletRequest?req,?HttpServletResponse?resp) ????????????throws?ServletException,?IOException?{ ????????this.doGet(req,?resp); ????} }
talk.jsp
<!DOCTYPE?html> <%@?page?language="java"?contentType="text/html;?charset=utf-8" ????pageEncoding="utf-8"%> <% String?path?=?request.getContextPath(); String?basePath?=?request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <html> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=UTF-8"?/> <title>微信公眾號</title> <!--討論區(qū)滾動條begin--> <link?rel="stylesheet"?type="text/css"?href="<%=basePath?%>resources/css/jscrollpane1.css"?/> <script?src="<%=?basePath?%>resources/js/common/jquery-1.8.0.min.js"?type="text/javascript"></script> <!--?the?mousewheel?plugin?--> <script?type="text/javascript"?src="<%=basePath?%>resources/js/common/jquery.mousewheel.js"></script> <!--?the?jScrollPane?script?--> <script?type="text/javascript"?src="<%=basePath?%>resources/js/common/jquery.jscrollpane.min.js"></script> <script?type="text/javascript"?src="<%=basePath?%>resources/js/common/scroll-startstop.events.jquery.js"></script> <!--討論區(qū)滾動條end--> <script?type="text/javascript"?src="<%=basePath?%>resources/js/front/talk.js"></script> </head> <body> <input?type="hidden"?value="<%=basePath?%>"?id="basePath"/> <br/> <div?class="talk"> <div?class="talk_title"><span>正在與公眾號對話</span></div> <div?class="talk_record"> <div?id="jp-container"?class="jp-container"> </div> </div> <div?class="talk_word"> <input?class="add_face"?id="facial"?type="button"?title="添加表情"?value=""?/> <input?id="content"?class="messages?emotion"???/> <input?class="talk_send"?onclick="send();"?type="button"?title="發(fā)送"?value="發(fā)送"?/> </div> </div> <div?style="text-align:center;margin:50px?0;?font:normal?14px/24px?'MicroSoft?YaHei';"></div> </body> </html>
現(xiàn)在第一條對話顯示了呢,不過漢字都是亂碼,發(fā)送按鈕還是沒作用的 呢
2017-08-23
ajax里面使用的數(shù)據(jù)傳送方式是post,你看下你的后臺servlet的方法是不是doPost,就是doPost方法里面處理事務(wù)。
2017-03-13
是怎么解決的?我發(fā)送按鈕也發(fā)送不了東西
2017-03-07
2017-03-07
貼出關(guān)鍵代碼。