pricingaction.java~8~

来自「EJB+Hibernate+Spring 电信计费系统」· JAVA~8~ 代码 · 共 93 行

JAVA~8~
93
字号
package tarena.netctoss.action;

import javax.servlet.http.*;

import org.apache.struts.action.*;
import org.apache.struts.actions.*;
import tarena.netctoss.biz.*;
import java.util.Collection;
import tarena.netctoss.exception.*;
import tarena.netctoss.actionform.PricingForm;
import tarena.netctoss.model.Tpricing;

public class PricingAction extends MappingDispatchAction {
    
    private PricingBIZ pricingBIZ;
    public ActionForward list(ActionMapping mapping, ActionForm form,
                              HttpServletRequest request,
                              HttpServletResponse response) {
        System.out.println("in list");
        Collection c = null;
        try {
             c = pricingBIZ.listAllPricing();
        } catch (InfrastructureException ex) {
            return mapping.findForward("systemError");
        }
        
        request.setAttribute("pricings",c);
        return mapping.findForward("success");
    }

    public ActionForward toAdd(ActionMapping mapping, ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response) {
        System.out.println("in toAdd");
        return mapping.findForward("success");
    }

    public ActionForward add(ActionMapping mapping, ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response) {
        System.out.println("in add");
        PricingForm pricingForm = (PricingForm)form;
        Tpricing pricing = new Tpricing();
        pricing.setBaseFee(pricingForm.getBaseFee());
        pricing.setPricingDesc(pricingForm.getPricingDesc());
        pricing.setPricingName(pricingForm.getPricingName());
        pricing.setRateFee(pricingForm.getRateFee());
        
        try {
            pricingBIZ.addPricing(pricing);
        } catch (RepeatBaseFeeAndRateFeeException ex) {
            return mapping.findForward("toAdd");
        } catch (InfrastructureException ex) {
            return mapping.findForward("systemError");
        }
        return mapping.findForward("success");
    }

    public ActionForward remove(ActionMapping mapping, ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response) {
        System.out.println("in remove");
        PricingForm pricingForm = (PricingForm)form;
        Long[] pricingIds = pricingForm.getPricingIds();
        pricingBIZ.removePricing(pricingIds);
        return mapping.findForward("success");
    }

    public ActionForward get(ActionMapping mapping, ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response) {
        System.out.println("in get");
        return mapping.findForward("success");
    }

    public ActionForward modify(ActionMapping mapping, ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response) {
        System.out.println("in modify");
        return mapping.findForward("success");
    }

    public PricingBIZ getPricingBIZ() {
        return pricingBIZ;
    }

    public void setPricingBIZ(PricingBIZ pricingBIZ) {
        this.pricingBIZ = pricingBIZ;
    }


}

⌨️ 快捷键说明

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