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

📄 editinfo.java

📁 使用OSGi框架开发的分布式电子辞典
💻 JAVA
字号:
/* * @(#)EditInfo.java. *  * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU Library General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */package cn.edu.ynu.sei.dict.web.data;import cn.edu.ynu.sei.dict.core.service.IDictEditService;import cn.edu.ynu.sei.dict.core.service.IDictQueryService;import cn.edu.ynu.sei.dict.core.service.Word;import cn.edu.ynu.sei.dict.plugin.user.service.IUserManager;import java.io.*;import javax.servlet.*;import javax.servlet.http.*;/** * Handle edit info of a word. * @author zy * @version 1.0.0.0, Mar 13, 2008 */public class EditInfo extends HttpServlet {    private IDictQueryService wordReader;    private IDictEditService wordWriter;    private IUserManager userManager;    /**     * default constructor.     */    public EditInfo() {    }    /**     * constructor with argument.     * @param qs     *         the interface for reading word.     * @param ds     *         the interface for writering word.     * @param um     *         the interface for user management.     */    public EditInfo(IDictQueryService qs, IDictEditService ds,IUserManager um) {        this.wordReader = qs;        this.wordWriter = ds;        this.userManager = um;    }    /**      * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.     * @param request servlet request     * @param response servlet response     */    protected void processRequest(HttpServletRequest request, HttpServletResponse response)            throws ServletException, IOException {        response.setContentType("text/html;charset=UTF-8");        PrintWriter out = response.getWriter();        HttpSession session = request.getSession();        Word word = (Word)session.getAttribute("result");        String def = request.getParameter("def");        def = new String(def.getBytes("iso-8859-1"),"utf-8");        word.definition = def;        wordWriter.editVocabulary(word);        session.removeAttribute("result");        out.write("编辑成功!");    }    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">    /**      * Handles the HTTP <code>GET</code> method.     * @param request servlet request     * @param response servlet response     */    protected void doGet(HttpServletRequest request, HttpServletResponse response)            throws ServletException, IOException {        processRequest(request, response);    }    /**      * Handles the HTTP <code>POST</code> method.     * @param request servlet request     * @param response servlet response     */    protected void doPost(HttpServletRequest request, HttpServletResponse response)            throws ServletException, IOException {        processRequest(request, response);    }    /**      * Returns a short description of the servlet.     */    public String getServletInfo() {        return "Short description";    }    // </editor-fold>}

⌨️ 快捷键说明

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