TAILIEUCHUNG - Mastering JavaServer™ Face phần 3

Wiley Thành phần Bản quyền năm 2004 của Wiley Publishing Inc, Indianapolis, Indiana. Tất cả các quyền. Được đăng bởi Wiley Publishing, Inc, Indianapolis, Indiana đã công bố đồng thời tại Canada một phần của ấn phẩm này có thể được sao chép, lưu trữ trong một hệ thống thu hồi, hoặc truyền đi dưới bất kỳ hình thức nào hoặc bằng bất kỳ | 72 Chapter 2 use JavaBean properties on the Converter or even generic attributes via the standard attribute tag to capture these values if they are subject to change with use. Every user interface component has methods for getting and setting a Converter. These methods are getConverter and setConverter respectively and they may be used to dynamically assign a Converter at any time. Converters are associated via a String-based converter identifier which we will cover in Chapter 4. Although you may associate a Converter with a user interface component by invoking its setConverter method you will typically set a Converter via an associated JSP tag attribute. If you take another look at Listing you ll see the custom credit card Converter being assigned to the credit card number input component via the converter attribute. This attribute is provided as part of the standard JSF HTML tag library. Behind the scenes the inputText tag just invokes the setConverter method for you with the converter identifier provided. Converter Registration When using your own custom Converter components you must first register them with your application in its associated JSF configuration file. This process is covered in Chapter 4 for the credit card Converter we have been using as an example here. As part of the registration process you provide a unique identifier for the Converter and this identifier is what you use to associate a Converter with a UlOutput component via its optional converter attribute. Standard Converters The JSF Specification requires every JSF implementation to provide a basic set of Converters. A summary of each standard Converter is provided in Table . These Converters basically give you a few different ways to convert input fields into dates and numbers with various styles and formats. As with standard Validators you ll need to declare the core JSF tag library in the JSP page you wish to use the Converters. An example usage of one of these standard Converters

Đã 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.