public static String generalFileName(String srcFileName) { try{ int index=srcFileName.lastIndexOf("."); return StrUtil.generalSrid()+srcFileName.substring(index).toLowerCase(); }catch(Exception e){ return StrUtil.generalSrid(); } }
public synchronized static String getID() { Random random = new Random(); StringBuffer ret = new StringBuffer(20); String rand = String.valueOf(Math.abs(random.nextInt()));
for (int i = 0; i < this.pageNumber; i++) { if (this.currentPage == i + 1) buf.append("<optionvalue=" + (i + 1) + "selected=\"selected\">" + (i + 1) + "</option>"); else buf.append("<optionvalue=" + (i + 1) + ">" + (i + 1) + "</option>");
*/ publicvoiddestroy(){ super.destroy(); // Just puts "destroy" string in log // Put your code here }
/** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ publicvoiddoGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doPost(request, response); }
/** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ publicvoiddoPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
StringBuffer sb = new StringBuffer(50); response.setContentType("application/x-msdownload;charset=utf-8"); try { response.setHeader("Content-Disposition", new String(sb.toString() .getBytes(), "ISO8859-1")); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace();