// 跳转发送短信页面 public ActionForward sendMessagePage( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws AppException { AgentListForm agentListForm = (AgentListForm) form; int[] idArray = agentListForm.getSelectedItems(); Agent agent = new Agent(); StringBuffer mobelArray = new StringBuffer(); for (int i = 0; i < idArray.length; i++) { agent = agentBiz.getAgentByid(idArray[i]); String name = agent.getName(); String mobel = agent.getMobilePhone(); if (mobel == null || mobel.trim().length() < 11) { // 号码小于11位 if (i == idArray.length - 1 && mobelArray.toString().endsWith(",")) { mobelArray.deleteCharAt(mobelArray.lastIndexOf(",")); } continue; } if (i != idArray.length - 1) { if (name != null && !"".equals(name.trim())) { if (name.indexOf("-") != 0) { mobelArray.append( mobel + "(" + name.substring(name.lastIndexOf("-") + 1).trim() + ")" + ","); } else { mobelArray.append(mobel + "(" + name.trim() + ")" + ","); } } else { mobelArray.append(mobel + ","); } } else { if (name != null && !"".equals(name.trim())) { if (name.indexOf("-") != 0) { mobelArray.append(mobel + "(" + name.substring(name.lastIndexOf("-") + 1).trim() + ")"); } else { mobelArray.append(mobel + "(" + name.trim() + ")"); } } else { mobelArray.append(mobel); } } } System.out.println(mobelArray.toString()); agentListForm.setReceiver(mobelArray.toString()); agentListForm.setThisAction("sendMobelMessage"); request.setAttribute("agentListForm", agentListForm); String forwardPage = "sendMessage"; return mapping.findForward(forwardPage); }