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

📄 loginaction.java

📁 SSH 开发网上订餐系统。由于SSH相关包太大不方便上传。请自行导入。
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.struts.action;

import java.util.Iterator;
import java.util.List;

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 org.apache.struts.action.DynaActionForm;

import com.web.model.FoodInfo;
import com.web.model.UserInfo;
import com.web.servic.FoodInfo_Intef;
import com.web.servic.UserInfo_Intef;

/** 
 * MyEclipse Struts
 * Creation date: 09-02-2008
 * 
 * XDoclet definition:
 * @struts.action path="/login" name="loginForm" input="/login.jsp" scope="request" validate="true"
 */
public class LoginAction extends Action {
	/*
	 * Generated Methods
	 */
	private UserInfo_Intef userInfo_Intef ;
	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm lf= (DynaActionForm) form;// TODO Auto-generated method stub
		String username = lf.getString("username").trim() ;
		String password = lf.getString("password").trim() ;		
		if(userInfo_Intef.findById(username)!=null&&userInfo_Intef.findByUPassword(password)!=null)
		{
			UserInfo userinfo= userInfo_Intef.findById(username) ;
			System.out.println("^^^^^^^^^^^^^^"+userinfo.getUId()) ;
			request.getSession().setAttribute("userinfo",userinfo) ;
			System.out.print("success") ;
			return mapping.findForward("index") ;
		}
		else 
		{
			request.getSession().setAttribute("error","error") ;
			return mapping.findForward("Login") ;
		}
	}
	
	public UserInfo_Intef getUserInfo_Intef() {
		return userInfo_Intef;
	}
	public void setUserInfo_Intef(UserInfo_Intef userInfo_Intef) {
		this.userInfo_Intef = userInfo_Intef;
	}


}

⌨️ 快捷键说明

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