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

📄 indexaction.java

📁 本项目源码是一个真实的应用项目
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package org.langsin.computer.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 org.apache.struts.validator.DynaValidatorForm;
import org.langsin.computer.service.IUserService;
import org.langsin.computer.util.IContants;
import org.langsin.computer.vo.User;
import org.langsin.computer.web.core.BaseAction;
import org.langsin.computer.web.core.SessionContainer;

/**
 * MyEclipse Struts Creation date: 05-27-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action path="/index" name="indexForm" input="/index.jsp"
 *                parameter="state" scope="request" validate="true"
 */
public class IndexAction extends BaseAction {
	private IUserService userService;

	public IUserService getUserService() {
		return userService;
	}

	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

	public ActionForward verify(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaValidatorForm indexForm = (DynaValidatorForm) form;// TODO

		String userName = indexForm.getString("userName");
		String userPwd = indexForm.getString("userPwd");

		User user = userService.verify(userName, userPwd);
		if (user != null) {
			getSessionContainer(request).setUser(user);
			return mapping.findForward(IContants.FORWARD_MAIN);
		} else {
			ActionMessages errors = new ActionMessages();
			errors.add("wrong", new ActionMessage("error.wrong"));
			this.saveErrors(request, errors);
			return mapping.getInputForward();
		}
	}
}

⌨️ 快捷键说明

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