easyjweb个性化操作

package com.test.mvc;

import java.io.Serializable;
import java.util.List;

import com.easyjf.container.annonation.Action;
import com.easyjf.container.annonation.Inject;
import com.easyjf.core.support.query.IQueryObject;
import com.easyjf.util.CommUtil;
import com.easyjf.web.Module;
import com.easyjf.web.Page;
import com.easyjf.web.WebForm;
import com.easyjf.web.tools.AbstractCrudAction;
import com.easyjf.web.tools.IPageList;

import com.test.domain.user;
import com.test.service.IuserService;

/**
 * userAction
 * 
 * @author EasyJWeb 1.0-m2 $Id: userAction.java,v 0.0.1 2008-1-25 0:10:17
 *         EasyJWeb 1.0-m2 Exp $
 */
@Action
public class userAction extends AbstractCrudAction {
	@Inject
	private IuserService service;

	/*
	 * set the current service return service
	 */
	public void setService(IuserService service) {
		this.service = service;
	}

	/*
	 * to get the entity class
	 */
	@SuppressWarnings("unchecked")
	protected Class entityClass() {
		return user.class;
	}

	/*
	 * 测试
	 */
	public Page doCeshi(WebForm form, Module module) {
		String id = CommUtil.null2String(form.get("id"));
		user user = this.service.getuser(new Long(id));
		user.setEmail("测试啵");
		this.service.updateuser(new Long(id), user);
		return go("list");
	}

	/*
	 * to find the entity object
	 */
	protected Object findEntityObject(Serializable id) {
		return service.getuser((Long) id);
	}

	/*
	 * to get the entity query param queryObject return IPageList
	 */
	protected IPageList queryEntity(IQueryObject queryObject) {
		return service.getuserBy(queryObject);
	}

	/*
	 * to remove an entity param id
	 */
	protected void removeEntity(Serializable id) {
		service.deluser((Long) id);
	}

	/*
	 * to batch remove the entities param ids
	 */
	protected void batchRemoveEntity(List<Serializable> ids) {
		service.batchDelusers(ids);
	}

	/*
	 * save object to entity
	 */
	protected void saveEntity(Object object) {
		service.adduser((user) object);
	}

	/*
	 * update an entited object
	 */
	protected void updateEntity(Object object) {
		service.updateuser(((user) object).getId(), (user) object);
	}

}


<a ondrag="return false;" title="修改该记录" href="?cmd=Ceshi&amp;id=$!info.id">测试</a> &nbsp;

你可能感兴趣的:(java,Web,mvc,webform,Go)