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

📄 newordervalidatoraction.java

📁 这是一个网上购物店的源码
💻 JAVA
字号:
package org.digitstore.web.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.digitstore.domain.Account;
import org.digitstore.service.AccountManager;
import org.digitstore.service.ManagerFactory;
import org.digitstore.web.struts.form.AccountActionForm;
import org.digitstore.web.struts.form.CartActionForm;
import org.digitstore.web.struts.form.OrderValidatorForm;

public class NewOrderValidatorAction extends SecureBaseAction {

    /*
     * (non-Javadoc)
     * 
     * @see org.digitstore.web.struts.action.SecureBaseAction#doExecute(org.apache.struts.action.ActionMapping,
     *      org.apache.struts.action.ActionForm,
     *      javax.servlet.http.HttpServletRequest,
     *      javax.servlet.http.HttpServletResponse)
     */
    protected ActionForward doExecute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        // TODO Auto-generated method stub
        AccountActionForm acctForm = (AccountActionForm) request.getSession()
                .getAttribute("accountForm");
        CartActionForm cartForm = (CartActionForm) request.getSession()
                .getAttribute("cartForm");
        AccountManager manager = ManagerFactory.createAccountManager();
        if (cartForm != null) {
            OrderValidatorForm orderForm = (OrderValidatorForm) form;
            // Re-read account from DB at team's request.
            Account account = manager.getAccount(acctForm.getAccount()
                    .getUsername());
            //orderForm.getOrder().initOrder(account, cartForm.getCart());
            return mapping.findForward("success");
        } else {
            request
                    .setAttribute("message",
                            "An order could not be created because a cart could not be found.");
            return mapping.findForward("failure");
        }
    }

}

⌨️ 快捷键说明

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