package sample.org.itscool.tutorial;
import java.util.ArrayList;

import org.itscool.weber.action.Action;
import org.itscool.weber.action.ActionBucket;

public class HelloAction extends Action{
    public String doExecute(ActionBucket bucket){
        HelloBean hello = (HelloBean)bucket.getForm();
        String newName = hello.getName().toUpperCase();
        hello.setName(newName);
        
        bucket.setAttribute("hello", hello);
        
        ArrayList personList = (ArrayList)bucket.getAttributeFromSession("personList");
        if( personList == null){
        	personList = new ArrayList();
        	bucket.setAttributeFromSession("personList", personList);
        }
        personList.add(hello);
        return "success";
    }
}

