package jp.agentec.sinaburocast.action;


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

import jp.agentec.sinaburocast.common.SinaburoConstant;
import jp.agentec.sinaburocast.common.util.SinaburoUtil;
import jp.agentec.sinaburocast.entity.Message;
import jp.agentec.sinaburocast.form.user.LoginForm;
import jp.agentec.sinaburocast.form.user.RegistForm;
import jp.agentec.sinaburocast.service.MessageService;

import org.seasar.struts.annotation.Execute;

public class IndexAction extends AbstractAction{

	public MessageService messageService;
	
	public LoginForm loginForm;
	public RegistForm registForm;

	
    @Execute(validator = false)
	public String index() {

    	List<Message> messageList = new ArrayList<Message>();

    	messageList = messageService.findByNews(SinaburoConstant.MessageCode.NEWS);

    	session.setAttribute("newsList",messageList);

		String yy = SinaburoUtil.getTimeStringAs(SinaburoConstant.Formats.TIMESTAMP_FORMAT_YEAR);
		session.setAttribute("birthYYYY", Integer.parseInt(yy));
        return "index.html";
	}
}