package example.action;


import org.nancle.annotation.ActionURL;
import org.nancle.annotation.ErrorPage;
import org.nancle.annotation.Page;
import org.nancle.annotation.Pages;
import org.nancle.context.NancleContext;

import example.form.CustomerForm;

public class CustomerManager {

    /**
     * 顧客登録初期画面の表示。
     */
    @ActionURL("/customer/input.do")
    @Pages({@Page(status="success", page="/mayaa/customer_input.html")})
    public String input() {
        return "success";
    }

    /**
     * 顧客登録確認画面の表示。
     */
    @ActionURL("/customer/confirm.do")
    @Pages({@Page(status="success", page="/mayaa/customer_confirm.html")})
    @ErrorPage("/mayaa/customer_input.html")
    public String confirm(CustomerForm cf) {
        NancleContext.getRequest().setAttribute("customerForm", cf);
        return "success";
    }
    
    /**
     * 顧客登録完了画面の表示。
     */
    @ActionURL("/customer/regist.do")
    @Pages({@Page(status="success", page="/mayaa/customer_regist.html")})
    @ErrorPage("/mayaa/customer_input.html")
    public String regist(CustomerForm cf) {
        // DBに書き込んだりする処理
        //...
        //...
        NancleContext.getRequest().setAttribute("customerForm", cf);
        return "success";
    }
}
