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

📄 orderlistexec.java

📁 BEA WebLogic Server 8.1大全 = BEA webLogic server 8.1 unleashed (美) Mark Artiges等著 袁毅 ... [等] 译 eng
💻 JAVA
字号:
package myApp.Action;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import java.util.Hashtable;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import myApp.Beans.*;

import org.apache.struts.action.Action;

public class OrderListExec extends Action {

  public OrderListExec() {
  }

  public ActionForward
      execute(ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response) throws Exception {

    ActionErrors errors = new ActionErrors();

    /* Example code if the user enters in 1234 for CustomerNo and password
         * the page will be forwarded to orderlistentry else an action error is added
     * displayed back to the front page
     */
    HttpSession session = null;
    try{
      session = request.getSession();
    }catch(Exception e){
      return mapping.findForward("killSession");
    }

    String user = (String) session.getAttribute("user");
    if (user == null) {
      errors.add("loginerror", new ActionError("error.login.expired"));
      super.saveErrors(request, errors);
      return mapping.findForward("login");
    }

    //put the data from the session in the shopping cart;
    dataBean data = new dataBean(
        request.getParameter("item"),
        request.getParameter("qty"),
        request.getParameter("date"));
    Vector order = (Vector) session.getAttribute("order");
    if (order == null) {
      order = new Vector();
    }
    order.add(data);
    session.setAttribute("order", order);
    Enumeration e = request.getParameterNames();
    while(e.hasMoreElements()){
    System.out.println(e.nextElement().toString());
    }
    if (request.getParameter("Enter") != null) {
      return mapping.findForward("success");
    }
    else if (request.getParameter("Display") != null) {
      return mapping.findForward("display");
    }
    else
      return mapping.findForward("logout");
  }

}

⌨️ 快捷键说明

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