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

📄 loginaction.java

📁 一个初学者的入门ssh应用。。。应该对很多人有帮助
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package org.langsin.web.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 org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.langsin.service.IUserService;
import org.langsin.web.struts.form.LoginForm;

/** 
 * MyEclipse Struts
 * Creation date: 05-20-2007
 * 
 * XDoclet definition:
 * @struts.action path="/login" name="loginForm" input="/login.jsp" scope="request" validate="true"
 */
public class LoginAction extends Action {
private IUserService userService;
	public IUserService getUserService() {
	return userService;
}
public void setUserService(IUserService userService) {
	this.userService = userService;
}
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
		String userName=loginForm.getUsername();
		String userPwd=loginForm.getPassword();
		if(userService.verify(userName, userPwd)){
			request.getSession().setAttribute("user", userName);
			return mapping.findForward("main");
		}else{
			ActionMessages errors=new ActionMessages();
			ActionMessage error=new ActionMessage("error.wrong");
			errors.add("wrong",error);
			this.saveErrors(request, errors);
			return mapping.getInputForward();
		}
		
	}
}

⌨️ 快捷键说明

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