|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?FreeOZ用户注册
x
- public class PayrollUploadJobStatusAction extends SecureAction
- {
- Properties props = new Properties();
- /**
- * @see SecureAction#securePerform(ActionMapping, ActionForm, ActionContext, HttpServletRequest, HttpServletResponse)
- */
- public ActionForward securePerform(ActionMapping mapping,
- ActionForm form,
- ActionContext actionContext,
- HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
-
- String forwardAction = Constants.ACTION_SUCCESS;
- getErrors(request);
- String saveUrl ="PayrollBatchJobStatus.jsp";
-
- //Check the status of importing
- String payrollFileId = request.getParameter("payrollFileId");
- PayrollFileBean pfBean = PayrollFileDao.retrieveByPayrollFileId(actionContext.getConnection(), (new Integer(payrollFileId)).intValue());
-
- if (pfBean != null && (pfBean.getStatus() == Constants.IMPORT_STATUS_IMPORTED
- || pfBean.getStatus() == Constants.IMPORT_STATUS_IMPORT_FAILED)) {
-
- forwardAction = Constants.ACTION_SUCCESS;
-
- ClientPayrollUploadJobStatusForm statusForm = new ClientPayrollUploadJobStatusForm();
- if (form != null)
- statusForm = (ClientPayrollUploadJobStatusForm)form;
-
- if (pfBean.getStatus() == Constants.IMPORT_STATUS_IMPORTED)
- statusForm.setAction(Constants.ACTION_SUCCESS);
- else
- statusForm.setAction(Constants.ACTION_FAILURE);
-
- List logs = IbasLogDao.retrieveByBatchId(actionContext.getConnection(), pfBean.getImportBatchId());
- Iterator it = logs.iterator();
- List msgList = new ArrayList();
- while (it.hasNext()) {
- com.rem.ibas.model.bean.IbasLogBean logBean = (com.rem.ibas.model.bean.IbasLogBean)it.next();
- msgList.add(logBean.getDescription());
- }
-
- //statusForm.setOriginalMessage(msg);
- statusForm.setPayrollFileId(pfBean.getPayrollFileId().toString());
- request.setAttribute("msgList", msgList);
- }
- else {
- forwardAction = Constants.ACTION_FAILURE;
-
- //use another object to avoid modifying orginal one
- ActionForward tempActionForward = new ActionForward();
- //Construct query string for forwardAction is success
- tempActionForward.setPath("/" + saveUrl);
- return (tempActionForward);
- }
-
- return (mapping.findForward(forwardAction));
- }
- }
复制代码 Struts config- <action path="/payrollUploadJobStatus"
- type="com.rem.ibas.model.action.PayrollUploadJobStatusAction"
- name="ClientPayrollUploadJobStatusForm"
- validate="false"
- scope="request">
- <forward name="success"
- path="/ClientPayrollImportResult.jsp"
- redirect="false">
- </forward>
- <forward name="failure"
- path="payrollUploadJobStatus.do"
- redirect="false">
- </forward>
- </action>
复制代码 jsp page- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <%@ page language="java" %>
- <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
- <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
- <HTML>
- <HEAD>
- <meta http-equiv="refresh" content="5">
- <META name="GENERATOR" content="IBM WebSphere Studio">
- <TITLE>Payroll Upload Status</TITLE>
- <LINK href="addMaterial/ibas.css" type=text/css rel=stylesheet>
- </HEAD>
- <body bgcolor="#ffffff">
-
- <img name="ibasMenu" src="images/remuneratorLogo.gif" width="760" height="55" border="0" usemap="#logo">
- <P>
- <P>
- <TABLE width="100%" border="0">
- <TR>
- <TD align=center>
- <FONT class="batchTxt">Please wait, Payroll Upload in progress.</FONT>
- </TD>
- </TR>
- <TR>
- <TD><P></TD>
- </TR>
- <TR>
- <TD align=center>
- <FONT class="mandatoryLabel">This page will automatically show the results of the upload, once it is complete.</FONT>
- </TD>
- </TR>
- </TABLE>
- </body>
- </HTML>
复制代码 请问,问什么上面的ACTION class 能持续的调用下面的jsp直到 满足pfBean != null && (pfBean.getStatus() == Constants.IMPORT_STATUS_IMPORTED
|| pfBean.getStatus() == Constants.IMPORT_STATUS_IMPORT_FAILED ?
我晕啊!!!
[ 本帖最后由 lufumin1832 于 16-1-2010 00:43 编辑 ] |
|