Expert Spring MVC and Web Flow phần 10

Như đã đề cập trong Chương 11, bạn thường sẽ yêu cầu những phương pháp này được thực hiện trước và sau khi xem hình thức hiển thịLiệt kê 12-21 cho thấy làm thế nào đểlàm điều nàybạn có thể phá vỡ mỗi bước vào trạng thái riêng biệt. | CHAPTER 12 ADVANCED SPRING WEB FLOW 361 Table 12-9. FormAction Coarse-Grained Methods Method Purpose Life Cycle setupForm Calls exposeFormObject but Before the form is displayed. also performs data binding if bindOnSetupForm is true . bindAndValidate Performs binding and validation After the form has been submitted. of the form object. As mentioned in Chapter 11 you would typically require these methods to be executed before and after a form view is displayed. Listing 12-21 shows how to do this. Listing 12-21. Spring Web Flow Fragment Showing Entry and Exit Actions on a View view-state id enterPurchaseInformation view purchaseForm entry-actions action bean formAction method setupForm entry-actions transition on submit to enterShippingInformation action bean formAction method bindAndValidate transition transition on cancel to cancel view-state As in Listing 12-19 you could break up each of the steps into distinct states. This is a little more verbose but more clearly demarcates the different steps. It also provides greater flexibility allowing you to reenter a state definition from a different point within the flow. Listing 12-22 shows this approach. Listing 12-22. Spring Web Flow Fragment Showing Form Management in Explicit States action-state id setupForm action bean formAction method setupForm transition on success to enterPurchaseInformation action-state view-state id enterPurchaseInformation view purchaseForm transition on submit to processPurchasePostback transition on cancel to cancel view-state action-state id processPurchasePostback action bean formAction method bindAndValidate transition on success to enterShippingInformation action-state 362 CHAPTER 12 ADVANCED SPRING WEB FLOW POJO Actions Chapter 11 defined the Action as the central construct for executing your application code from within a flow definition. It also stated that every action bean had to implement the interface. And this is true. Every Spring Web Flow .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.