📄 replynote.java
字号:
package com.ntsky.note;import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;import com.ntsky.note.CodeFilter;import com.ntsky.note.SQLDBOperator;public class ReplyNote extends HttpServlet { private SQLDBOperator sdbo = null; private static final String CONTENT_TYPE = "text/html; charset=GBK"; //Initialize global variables public void init() throws ServletException { } //Process the HTTP Post request public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(CONTENT_TYPE); //PrintWriter out = response.getWriter(); request.setCharacterEncoding("GBK"); int noteId = Integer.parseInt(request.getParameter("noteId")); String content = CodeFilter.toHtml(request.getParameter("content")); if (sdbo == null) sdbo = SQLDBOperator.getInstance("Connection"); String sql ="insert into reply(noteId,content,replyTime) values(?,?,now());"; try { sdbo.prepareStatement(sql); sdbo.setInt(1,noteId); sdbo.setString(2,content); sdbo.executeUpdate(); URLServlet.getUrl(response,"default.jsp"); } catch(Exception e){ System.out.print("ReplyNote insReply " + e.getMessage()); Debug.writeLog("ReplyNote insReply, Exception Occured ! Info :" + e.getLocalizedMessage()); } finally { sdbo.Close(); } } //Clean up resources public void destroy() { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -