⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initservlet.java

📁 一个基于java的记事本
💻 JAVA
字号:
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() {    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -