filtaction.java

来自「EasyJF开源新闻系统是一个由EasyJF开源团队组织开发的基于Java平台的」· Java 代码 · 共 64 行

JAVA
64
字号
/**
 * 版权声明  EasyJF, 版权所有 违者必究
 * 版本号  0.1
 *创建者:张钰
 * 时 间:2006-4-6
 * 描 述:创建
 */
package com.easyjf.news.action;

import com.easyjf.news.logic.impl.FiltServiceImpl;
import com.easyjf.news.model.Constants;
import com.easyjf.news.model.Filter;
import com.easyjf.news.model.User;
import com.easyjf.web.ActionContext;
import com.easyjf.web.Module;
import com.easyjf.web.Page;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.AbstractCmdAction;

public class FiltAction extends AbstractCmdAction {
	User user = (User) ActionContext.getContext().getSession().getAttribute(
			Constants.SESSION_USER);

	Integer popedom;

	FiltServiceImpl filtdao = FiltServiceImpl.getInstance();

	public Page doInit(WebForm form, Module module) {
		// TODO Auto-generated method stub
		if (user != null) {
			popedom = user.getPopedom();
			if (popedom == 3) {
				return new Page("filt", "/filter.html");
			} else {
				return new Page("login", "/userLogin.html");
			}
		} else {
			return new Page("login", "/userLogin.html");
		}

	}

	public Page doSave(WebForm form, Module module) {
		if (user != null) {
			popedom = user.getPopedom();
			if (popedom == 3) {
				Filter filter = (Filter) form.toPo(Filter.class);
				if (filtdao.saveFilt(filter)) {
					form.addResult("msg", "添加成功!");
					return new Page("filter", "/filter.html");
				} else {
					return new Page("filter", "/filter.html");
				}
			} else {
				return new Page("noright", "/noright.html");
			}

		} else {
			return new Page("login", "/userLogin.html");
		}
	}

}

⌨️ 快捷键说明

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