package com.reallinkbilling.jspRedirect;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class AbsentPresentReportJsp extends ActionSupport {
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4841663637265751056L;
	private String fromDate;
	private String toDate;
	
	private HttpSession session;
	String result = "login";
	public String execute() throws Exception {
	session=ServletActionContext.getRequest().getSession(false); 
	 
        if(session==null || session.getAttribute("login")==null){ 
        	addActionMessage("Please Login First !!!");
        	result = "login";
        }  
        else{
        	
        	Date d = new Date();
        	SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
        	this.setFromDate(dateFormat.format(d));
        	this.setToDate(dateFormat.format(d));
        	
        	result = SUCCESS;
        }
        
        return result;
        
	}
		public String getFromDate() {
			return fromDate;
		}
		public void setFromDate(String fromDate) {
			this.fromDate = fromDate;
		}
		public String getToDate() {
			return toDate;
		}
		public void setToDate(String toDate) {
			this.toDate = toDate;
		}
	
		public static long getSerialversionuid() {
			return serialVersionUID;
		}
        
        
}
