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

📄 indexaction.java

📁 用MVC实现JSP购物车案例说明详细设计方案
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.yourcompany.struts.action;
import com.shop.model.*;
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.apache.struts.actions.DispatchAction;
import com.yourcompany.struts.form.IndexForm;

/** 
 * MyEclipse Struts
 * Creation date: 05-14-2008
 * 
 * XDoclet definition:
 * @struts.action path="/index" name="indexForm" input="/index.jsp" parameter="path" scope="request"
 */
public class IndexAction extends DispatchAction {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward login(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		IndexForm indexForm = (IndexForm) form;// TODO Auto-generated method stub
		String u=indexForm.getUsername();
		String p=indexForm.getPasswod();
		UserBeanBo ubb=new UserBeanBo();
		//UserBean ub=ubb.getUb(u);
		//MyCart mc=new MyCart();
		//request.getSession().setAttribute("myCart", mc);
		boolean b=ubb.check(u, p);
		
		
		if(b==true)
		{
			MyCart mc=new MyCart();
			request.getSession().setAttribute("myCart", mc);
			request.getSession().setAttribute("uname", u);
			
			return mapping.findForward("ok");
			
		}
		else
		{
			return mapping.getInputForward();
		}
	}
}

⌨️ 快捷键说明

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