?? initservlet.java
字號(hào):
package com.ntsky.note;import java.io.*;import java.sql.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;import com.ntsky.note.MD5;import com.ntsky.note.URLServlet;import com.ntsky.note.SQLDBOperator;public class InitServlet 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 { request.setCharacterEncoding("GBK"); response.setContentType(CONTENT_TYPE); PrintWriter out = response.getWriter(); //out.println(request.getParameter("adminPasswd")); String adminName = CodeFilter.toHtml(request.getParameter("adminName")); String adminPasswd = MD5.toMD5(CodeFilter.toHtml(request.getParameter("adminPasswd"))); //out.println(adminPasswd); if (sdbo == null) sdbo = SQLDBOperator.getInstance("Connection"); String sql = "insert into admin(adminName,adminPasswd) values('"+adminName+"','"+adminPasswd+"');"; try { sdbo.executeUpdate(sql); URLServlet.getUrl(response,"index.jsp"); } catch(Exception e){ System.out.print("Manager insReply " + e.getMessage()); Debug.writeLog("Manager insReply, Exception Occured ! Info :" + e.getLocalizedMessage()); } finally { sdbo.Close(); out.close(); } } //Clean up resources public void destroy() { }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -