package com.javahonk.action;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

import com.opensymphony.xwork2.ActionSupport;

@ParentPackage("json-default")
public class JasonAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private Map<String, String> jasonMap = new HashMap<String, String>();
	private List<String> jasonList = new ArrayList<String>();
	private String name;

	public JasonAction() {
		jasonMap.put("Java", "Java");
		jasonMap.put("Honk", "Honk");
		jasonList.add("Java");
		jasonList.add("Honk");
		name = "Java Honk";
	}

	@Override
	@Action(value = "/jasonAction", results = 
		{ @Result(name = "success", type = "json") })
	public String execute() throws Exception {
		return ActionSupport.SUCCESS;
	}

	public Map<String, String> getJasonMap() {
		return jasonMap;
	}

	public void setJasonMap(Map<String, String> jasonMap) {
		this.jasonMap = jasonMap;
	}

	public List<String> getJasonList() {
		return jasonList;
	}

	public void setJasonList(List<String> jasonList) {
		this.jasonList = jasonList;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
