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

📄 getattentionlist.java

📁 使用OSGi框架开发的分布式电子辞典
💻 JAVA
字号:
/* * @(#)GetAttentionList.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.User;import cn.edu.ynu.sei.dict.plugin.user.service.IUserManager;import java.io.*;import java.util.List;import javax.servlet.*;import javax.servlet.http.*;/** * Get the attention list of a particular user. * @author zy * @version 1.0.0.0, Mar 14, 2008 */public class GetAttentionList extends HttpServlet {        private IUserManager userManager;        /**     * default constructor.     */    public GetAttentionList(){            }        /**     * constructor with argument.     * @param userManager     *         the interface of user management.     */    public GetAttentionList(IUserManager userManager){        this.userManager = userManager;    }       /**     * 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();        User user = (User)session.getAttribute("user");        List<String> ns = userManager.findAllSubscriptions(user.name);        String startIndex;        if(ns.size() == 0){            startIndex = user.name;        }        else{            startIndex = ns.get(ns.size()-1);        }        String output = "<br><h2>My Friend</h2>" +                "<input id='newfriend' type='text' size='18'/>" +                "<input type='button' value='Add'  onclick=\"addItem('newfriend','" + startIndex +"')\"/><form id='checklist' name='alform'>" +                "<div>" + "朗道英汉字典5.0" + "<input type='radio' name='rlist' value='ld' checked/></div>" +                "<div id='" + user.name + "'>" + user.name + "<input type='radio' name='rlist' value='" + user.name + "'/></div>";        for(int i = 0;i<ns.size();i++){            output += "<div id='" + ns.get(i) +"'>" + ns.get(i)                     + "<input type='radio' name='rlist' value='"                     + ns.get(i) + "'/>"                    + "<a href='#' onclick=\"deleteItem('" + ns.get(i) + "')\" title='Delete Friend' style='text-decoration:none; padding-left:80px'>" +                    "<img src='DelFriend.gif' alt='Delete Friend' width='12' height='5' border='0' /></a></div>";        }        output += "</form>";        out.write(output);    }     // <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 + -