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

📄 customerinfoaction.java

📁 基于struts的网上商店源码
💻 JAVA
字号:
/*
 * 作者:武律
 * 时间:2007年11月23日
 * 功能:处理用户基本信息
 */
package com.mole.struts.action;

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

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.mole.struts.bean.CustomerInfoBean;
import com.mole.struts.dao.CustomerInfoDAO;

/**
 * MyEclipse Struts Creation date: 11-23-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action input="/customerInfo.jsp" validate="true"
 */
public class CustomerInfoAction extends Action {

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CustomerInfoDAO dao = new CustomerInfoDAO();
		CustomerInfoBean customerInfo = null;
		String action = request.getParameter("action");
		String cid = request.getParameter("vid");
		if (cid == null)
			cid = request.getSession().getAttribute("user").toString();
		// 判断是否处于查看模式
		if ("visit".equals(action)) {
			try {
				customerInfo = dao.getCustomerInfo(cid);
			} catch (Exception e) {
				e.printStackTrace();
			}
			request.setAttribute("CustomerInfo", customerInfo);
			return new ActionForward("/customerPersonalInfo.jsp");
		} else {
			try {
				customerInfo = dao.getCustomerInfo(cid);
			} catch (Exception e) {
				e.printStackTrace();
			}
			request.setAttribute("CustomerInfo", customerInfo);
			return mapping.findForward("goCustomerInfo");
		}
	}
}

⌨️ 快捷键说明

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