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

📄 initczksearchaction.java

📁 struts+hibernate3的源程序
💻 JAVA
字号:
package org.helpsoft.actions;

import java.util.Collection;
import java.util.Iterator;
import java.util.ArrayList;

import javax.servlet.http.*;
import org.helpsoft.servicelocator.*;
import org.helpsoft.session.AssociatorManageService;
import org.apache.struts.action.*;
import org.apache.commons.beanutils.BeanUtils;

import com.helpsoft.util.log.*;
import org.helpsoft.session.*;
import org.helpsoft.forms.CzkSearchForm;
import org.helpsoft.entity.czk.*;

/**
 * The initialise Action for the czk search screen.
 *
 * @author  cao guangxin - www.relationinfo.com
 * @struts.action path="/initCzkSearch"
 *                type="org.helpsoft.actions.InitCzkSearchAction"
 *                name="czkSearchForm"
 *                scope="request"
 *                validate="false"
 * @struts.action-forward name="success" path="/czkList.jsp"
 */
public class InitCzkSearchAction extends ServiceAction {

   private static Logger log = LogService.getLogger(InitCzkSearchAction.class);

   /**
    * Performs an action.
    *
    * @param mapping The ActionMapping used to select this instance
    * @param actionForm The optional ActionForm bean for this request (if any)
    * @param request The optional ActionForm bean for this request (if any)
    * @param response The HTTP response we are creating
    * @return describes where and how control should be forwarded, or <code>null</code> if the response has already
    *         been completed
    * @throws Exception in case of an error
    */
   public ActionForward doPerform(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
                                  HttpServletResponse response) throws Exception {
      Collection czkList =
            getAssociatorManageService().getCzkList();
      // We decorate the list with data objects that contain presentation specific methods
      ArrayList result = new ArrayList();
      if (czkList != null) {
      Iterator iterator = czkList.iterator();
         while (iterator.hasNext()) {
            CzkIf object =  (CzkIf) iterator.next();
            CzkData data = new CzkData();
            try {
               BeanUtils.copyProperties(data, object);
            } catch (Exception e) {
               // As fallback, we use the data constructor.
               log.warn("Error while copying properties using BeanUtils. Use fallback constructor...", e);
               data = new CzkData(object);
            }
            result.add(data);
         }
      }
      ((CzkSearchForm) actionForm).setCzkList(result);
      return mapping.findForward("success");
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -