/*
 * JmakiAction.java
 *
 * Created on May 29, 2007, 5:07 PM
 */

package com.myapp.struts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

import java.util.ArrayList;
/**
 *
 * @author cmott
 * @version
 */

public class JmakiAction extends Action {
    
    /* forward name="success" path="" */
    private final static String SUCCESS = "success";
    
    
    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param form The optional ActionForm bean for this request.
     * @param request The HTTP Request we are processing.
     * @param response The HTTP Response we are processing.
     * @throws java.lang.Exception
     * @return
     */
    public ActionForward execute(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
       
        ArrayList al = new ArrayList();                
        ListItem sf = new ListItem("San Francisco", 65);
        ListItem ny = new ListItem("New York", 85);
        ListItem hi = new ListItem("Honolulu", 80);    
        al.add(sf);
        al.add(ny);
        al.add(hi);

        request.setAttribute("data", al);

        return mapping.findForward(SUCCESS);        
    }
}