package com.javahonk.action;

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

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;

@Results({ @Result(name = "error", location = "/index.jsp"),
		@Result(name = "input", location = "/index.jsp") })
public class HiddenValueAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private List<Person> personsList = new ArrayList<Person>();
	private String hiddenValue;

	@Override
	@Action(value = "/hiddenValueAction")
	public String execute() throws Exception {

		for (int i = 0; i < 5; i++) {
			Person person = new Person();
			person.setFirstName("Java"+i);
			person.setLastName("Honk");
			person.setLocation("NY");
			person.setCheckbox(String.valueOf(i));
			personsList.add(person);
		}
		return ActionSupport.INPUT;
	}

	public List<Person> getPersonsList() {
		return personsList;
	}

	public void setPersonsList(List<Person> personsList) {
		this.personsList = personsList;
	}

	public String getHiddenValue() {
		return hiddenValue;
	}

	public void setHiddenValue(String hiddenValue) {
		this.hiddenValue = hiddenValue;
	}
	
	

}
