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

📄 logonaction.java

📁 java web模拟的简单的一个网络硬盘
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.dark.nethd.web.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.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

import com.dark.nethd.bean.UserInfo;
import com.dark.nethd.web.form.UserInfoForm;
import com.dark.nethd.Constants;

public class LogonAction extends BaseAction {
	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		UserInfoForm userInfoForm = (UserInfoForm) form;
		
		UserInfo ui = this.getUserInfoService().findUserByNameAndPassword(
				userInfoForm.getUserInfo().getUserName(),
				userInfoForm.getUserInfo().getPassWord());
		if (ui == null) {
			ActionMessages errors = new ActionMessages();
			errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.logon"));
			this.saveErrors(request, errors);
			return (new ActionForward(mapping.getInput()));
		} else {
			request.getSession().setAttribute(Constants.USER_SESSION_KEY, ui);
			request.removeAttribute(mapping.getAttribute());
			return mapping.findForward(Constants.FORWARD_SUCCESS);
		}
	}
}

⌨️ 快捷键说明

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