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

📄 loginaction.java.svn-base

📁 学习dwr+struts2+spring进行开发的好例子
💻 SVN-BASE
字号:
package com.szhelper.lotteryWeb.webapp.action;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ActionContext;
import com.szhelper.lotteryWeb.Constants;
import com.szhelper.lotteryWeb.util.WebConfig;


import com.szhelper.lotteryWeb.util.Md5Encrypt;

import java.util.*;

public class LoginAction extends LotteryWebBaseActionWrap {
	private String userId;
	private String password;

	public String execute() throws Exception {
		if (WebConfig
				.getStringValue(Constants.LOGIN_ADMINISTRATOR_USERID, null)
				.equals(userId)
				&& WebConfig.getStringValue(
						Constants.LOGIN_ADMINISTRATOR_PASSWORD, null).equals(
						Md5Encrypt.encode(password))) {
			//Map session = ActionContext.getContext().getSession();
			session.put(Constants.LOGIN_FLAG, Constants.LOGIN_FLAG_VALUE);
			session.put(Constants.LOGIN_ADMINISTRATOR_USERID, userId);
			LOG.info("welcome!");
			return SUCCESS;
		} else {
			LOG.info("not login!");
			return INPUT;
		}
	}

	public String logout() throws Exception {
		Map session = ActionContext.getContext().getSession();
		session.remove(Constants.LOGIN_FLAG);
		return SUCCESS;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}
}

⌨️ 快捷键说明

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