messageservice.java

来自「用struts」· Java 代码 · 共 56 行

JAVA
56
字号
package com.accp.service;

import java.util.List;

import com.accp.dao.MessageIDAO;
import com.accp.dto.Message;
import com.accp.exception.MessageException;

public class MessageService implements MessageIService {
	
	private MessageIDAO messageDao;

	public void setMessageDao(MessageIDAO messageDao) {
		this.messageDao = messageDao;
	}
	
	
	public void addMessage(Message msg)throws MessageException{
		try{
			messageDao.saveOrUpdate(msg);
		}catch(Exception e){
			e.printStackTrace();
			throw new MessageException("addMessage Method Error.........");
		}
	}
	
	public List getAllMessage()throws MessageException{
		try{
			return messageDao.findAll();
		}catch(Exception e){
			e.printStackTrace();
			throw new MessageException("getAllMessage Method Error..............");
		}
	}
	
	
	public List getPage(int curpage,int pagesize)throws MessageException{
		try{
			return messageDao.findPage(curpage,pagesize);
		}catch(Exception e){
			e.printStackTrace();
			throw new MessageException("getPage Method Error ............");
		}
	}
	
	
	public int getPageCount(int pagesize)throws MessageException{
		try{
			return messageDao.findPageCount(pagesize);
		}catch(Exception e){
			e.printStackTrace();
			throw new MessageException("getRows Method Error.............");
		}
	}
}

⌨️ 快捷键说明

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