ECLIPSE WEB TOOLS PLATFORM developing java web applications PHẦN 5

Chúng tôi thảo luận các khía cạnh kiến trúc của bộ phận này trong Chương 5. Chúng tôi thảo luận về WTP hỗ trợ cho logic trình bày trong chương này và cho doanh nghiệp logic trong Chương, tiếp theo 8. Việc phân chia giữa trình bày và logic kinh doanh đặc biệt quan trọng trong các ứng dụng web vì hai lý do. | 274 CHAPTER 7 The Presentation Tier import import import import import import import import Servlet implementation class for Servlet ScheduleServlet public class ScheduleServlet extends HttpServlet implements private static final long serialVersionUID 1L protected void doGet HttpServletRequest request HttpServletResponse response throws ServletException IOException try ServletContext context getServletContext InputStream xsl Source xslSource new StreamSource xsl TransformerFactory factory Templates templates xslSource Transformer transformer InputStream xml Source xmlSource new StreamSource xml PrintWriter out Result htmlResult new StreamResult out xmlSource htmlResult catch TransformerException e throw new ServletException e The servlet uses TrAX to apply to . TrAX uses the AbstractFactory creational pattern as described in Chapter 3 of Design Patterns Gamma1995 by Erich Gamma et al. This pattern lets you create a transformer without specifying the concrete implementation class. There are several Java XSLT implementations such as Xalan and Saxon so using the AbstractFactory pattern lets your code be independent of the particular Iteration 6 Servers Dynamic Web Projects and Servlets 275 implementation that is configured in your JDK. Using TrAX therefore makes your code more portable. The servlet uses the servlet context to get input streams for and . This technique is preferred to directly .

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
10    80    1    29-05-2024
5    78    1    29-05-2024
45    85    1    29-05-2024
Đã 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.