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 = "success", location = "/success.jsp"),
		@Result(name = "input", location = "/input.jsp") })
public class Struts2SampleCodeAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private String selectedRadionButton;
	private List<String> radioButtonList = new ArrayList<String>();
	

	public Struts2SampleCodeAction() {
		radioButtonList.add("NY");
		radioButtonList.add("NJ");
		radioButtonList.add("MA");
		setRadioButtonList(radioButtonList);		
	}

	@Override
	@Action(value = "/struts2SampleCodeAction")
	public String execute() throws Exception {
		return ActionSupport.SUCCESS;
	}

	@Action(value = "/displayAction")
	public String displayPage() {
		return ActionSupport.INPUT;
	}	

	public List<String> getRadioButtonList() {
		return radioButtonList;
	}

	public void setRadioButtonList(List<String> radioButtonList) {
		this.radioButtonList = radioButtonList;
	}

	public String getSelectedRadionButton() {
		return selectedRadionButton;
	}

	public void setSelectedRadionButton(String selectedRadionButton) {
		this.selectedRadionButton = selectedRadionButton;
	}
	
}
