struts
spring
action
@SuppressWarnings("unused") public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) { javax.servlet.http.HttpSession session = request.getSession(false); if (session == null) session = request.getSession(true); String validate = (String) request.getAttribute("GLOBE_VALIDATE"); String invs = Pattern.compile("[^0-9,,]").matcher(request.getParameter("selinv")).replaceAll(""); String invid[] = invs.split(","); Invoiceinfo invoiceinfo=null; Invoiceinfo invoiceinfotwo=null; ActionForward forward = null; String message = null; boolean messageFlag = false; invoiceinfo = invoiceinfohcDao.findById(String.valueOf(invid[0])); invoiceinfotwo=invoiceinfohcDao.findById(String.valueOf(invid[1])); //发票购销方税号一致,名称一致 if((invoiceinfo.getGfmc()).equals(invoiceinfotwo.getGfmc()) && (invoiceinfo.getXfmc()).equals(invoiceinfotwo.getXfmc()) && (invoiceinfo.getEnterpriseid()).equals(invoiceinfotwo.getEnterpriseid()) && (invoiceinfo.getDistributiontaxnumber()).equals(invoiceinfotwo.getEnterpriseid())){ try { if (invoiceinfo.getBz()!=null && invoiceinfo.getBz().equals(invoiceinfotwo.getBz())) {//发票备注流水号一致 invoiceinfohcDao.updateHcById(String.valueOf(invoiceinfo.getId())); invoiceinfohcDao.updateBySN(invoiceinfo.getBz()); /*request.setAttribute("message", "解决红冲异常成功!!"); forward = mapping.findForward("default");*/ messageFlag = false; message = (new StringBuilder("解决红冲异常成功!!")).toString(); }else{ invoiceinfohcDao.updateHcById(String.valueOf(invoiceinfo.getId())); /*request.setAttribute("message", "解决红冲异常成功!!"); forward = mapping.findForward("default");*/ messageFlag = false; message = (new StringBuilder("解决红冲异常成功,未发现流水号,流水号信息未更新!!")).toString(); } } catch (Exception e) { /*request.setAttribute("message",e.getMessage()); forward = mapping.findForward("default");*/ messageFlag = false; message = (new StringBuilder("解决红冲异常失败!系统异常!")).append( e.getMessage()).toString(); } }else{ /*request.setAttribute("message","解决红冲异常失败!发票异常!!"); forward = mapping.findForward("default");*/ messageFlag = false; message = (new StringBuilder("解决红冲异常失败!发票异常!!")).toString(); /* ActionMessages messages = new ActionMessages(); messages.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage("解决红冲异常失败!发票异常!!")); saveMessages(request, messages);*/ } request.setAttribute("informessageMsg", message); System.out.println(message); return mapping.findForward("success"); }
jsp
<span class="hrMsg"><bean:write name="informessageMsg" scope="request" /></span>
<span class="hrMsg"><bean:write name="informessageMsg" scope="request"/></span>
我不懂java语法,但是从名字上来看,request.setAttribute应该是给某个东西设置值,是否取值应该用类似于request.getAttrubutute的语法。
是请求的request 对象,,和返回的request 的对象,, 不是同一个对象