package roseindia.action;

import java.util.ArrayList;
import java.util.List;

import roseindia.hibernateDAO.CriteriaDAO;
import roseindia.model.StudentModel;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class AccessValue extends ActionSupport implements
		ModelDriven<StudentModel> {
	List<StudentModel> studentList = new ArrayList<StudentModel>();
	StudentModel obModel;
	CriteriaDAO obDao = new CriteriaDAO();
	public String execute() throws Exception {
		studentList = obDao.resultData(obModel);
		System.out.println("Size : "+ studentList.size());
		if(studentList.size()!=0)
		{
		return SUCCESS;
		}
		else {
			addActionError("Please enter valid id..");
			return INPUT;
		}
	}
	@Override
	public StudentModel getModel() {
		// TODO Auto-generated method stub
		obModel = new StudentModel();
		return obModel;
	}
	public List<StudentModel> getStudentList() {
		return studentList;
	}

	public void setStudentList(List<StudentModel> studentList) {
		this.studentList = studentList;
	}

}
