課程
/后端開發(fā)
/Java
/通過自動(dòng)回復(fù)機(jī)器人學(xué)Mybatis---基礎(chǔ)版
那個(gè)輸入指令和回復(fù)信息,之前是怎么設(shè)定的?
2017-04-17
源自:通過自動(dòng)回復(fù)機(jī)器人學(xué)Mybatis---基礎(chǔ)版 2-2
正在回答
你可以看一下talk.js文件中,輸入指令放在請(qǐng)求的“content”屬性中的,而回復(fù)信息是在服務(wù)端直接通過Response的PrintWriter對(duì)象 直接輸出回瀏覽器的
talk.js文件中:
$.ajax({
url : $("#basePath").val() + "talk/autoReplyMessage",
type : "POST",
dataType : "text",
timeout : 10000,
success : function (data) {
appendDialog("talk_recordboxme","My賬號(hào)",content);
appendDialog("talk_recordbox","小機(jī)",data);
$("#content").val("");
render();
},
data : {"content":content}
我的Controller文件中:
@RequestMapping(value="/autoReplyMessage")
public ModelAndView getMessagesByCommand(@RequestParam("content") String command,
HttpServletResponse response) {
response.setContentType("text/html;charset=utf-8");
PrintWriter out = null;
try {
out = response.getWriter();
String reply = messageService.getMessagesByCommand(command);
out.print(reply);
out.flush();
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
希望能幫到你。
舉報(bào)
微信公眾號(hào)自動(dòng)回復(fù)功能學(xué)習(xí)Mybatis,基礎(chǔ)教程加案例實(shí)戰(zhàn)方式學(xué)習(xí)
1 回答請(qǐng)教一下斷點(diǎn)查詢的問題?
1 回答斷點(diǎn)調(diào)試最后一步出現(xiàn)問題
5 回答看不懂,那位大神幫忙解答一下
1 回答獲得id值得目的
1 回答請(qǐng)問大神一個(gè)問題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-04-18
你可以看一下talk.js文件中,輸入指令放在請(qǐng)求的“content”屬性中的,而回復(fù)信息是在服務(wù)端直接通過Response的PrintWriter對(duì)象 直接輸出回瀏覽器的
talk.js文件中:
$.ajax({
url : $("#basePath").val() + "talk/autoReplyMessage",
type : "POST",
dataType : "text",
timeout : 10000,
success : function (data) {
appendDialog("talk_recordboxme","My賬號(hào)",content);
appendDialog("talk_recordbox","小機(jī)",data);
$("#content").val("");
render();
},
data : {"content":content}
我的Controller文件中:
@RequestMapping(value="/autoReplyMessage")
public ModelAndView getMessagesByCommand(@RequestParam("content") String command,
HttpServletResponse response) {
response.setContentType("text/html;charset=utf-8");
PrintWriter out = null;
try {
out = response.getWriter();
String reply = messageService.getMessagesByCommand(command);
out.print(reply);
out.flush();
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
希望能幫到你。