package com.javahonk.action;

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;
import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;

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

	private static final long serialVersionUID = 1L;
	private String personName;
	private String password;
	
	@Override
	@Action(value = "/struts2SampleCodeAction")	
	public String execute() throws Exception {
		
		return ActionSupport.SUCCESS;
	}

	public String getPersonName() {
		return personName;
	}
	
	@RequiredStringValidator(key = "error.personName.required")
	public void setPersonName(String personName) {
		this.personName = personName;
	}

	public String getPassword() {
		return password;
	}

	@RequiredStringValidator(key = "error.password.required")
	public void setPassword(String password) {
		this.password = password;
	}
	
}
