tailieunhanh - Building Spring 2 Enterprise Applications phần 9

TransactionInterceptor là một lớp thread-an toàn bắt đầu một giao dịch trước khi một phương pháp được thực hiện và kết thúc sau khi thoát khỏi thực hiện phương pháp. Ví dụ 7-3 cho thấy cấu hình của TransactionInterceptor, trong một file XML Xuân. Danh sách | 266 CHAPTER 9 VIEW TECHNOLOGIES JSP JSP is part of the J2EE specification as an extension of the Java servlet technology which makes it an out-of-the-box view technology option for all servlet containers and application servers. It is currently the mostly widely used view technology for Java web applications. In the previous chapter you used JSP as a means of rendering your views. Based on the data in the model the JSP file took care of rendering the HTML. Preventing Scriplet Use JSP allows you to write scriptlets in your view files however you should not use them. Using Java code in your view files increases the risk of including more than just view-related functionality in your view files. This will prevent you from migrating to another view technology at a later stage. You can prevent the use of scriptlets in your view files by adding the JSP property to your file as follows jsp-property-group url-pattern .jsp url-pattern scripting-invalid true scripting-invalid jsp-property-group Using an Expression Language and Spring-Provided Tags As of JSP and older versions in combination with JSTL tags it is also possible to use an expression language to simplify accessing data in your model. You have already seen this expression language at work in the previous chapter. It uses the xxx notation to access variables in your model where xxx is the key under which the requested data is in the model. To help you implement views using JSP pages Spring provides a number of tags as part of its web framework. These tags help you use the JSP technology in conjunction with the Spring Framework. Table 9-2 lists the most commonly used tags Spring provides. Table 9-2. Commonly Used Spring-Provided Tags Tag Name Description spring bind Evaluates the status of a certain bean or property. The status is bound to the request context in the form of a BindStatus instance. spring transform Allows you to transform a certain value that is not part of your command object in the same .

TỪ KHÓA LIÊN QUAN