tailieunhanh - Web Server Programming phần 7

khác nhau được tham chiếu trong liên kết. Những tên tập tin là được in khi dữ liệu đầu vào có tất cả được xử lý. (6) Ví dụ này là để thực hiệnNếu các tài liệu XML đã được kiểm tra tính hợp lệ, một tập tin với một DTD sẽ phải được tạo ra, | 364 JSP Java Server Pages servlet-mapping servlet-name SoccerServlet servlet-name url-pattern SoccerInfo url-pattern servlet-mapping web-app In this example the role of the PreprocessServlet is simply to handle HTTP get requests. It could have been given responsibility for a persistent database connection but this responsibility has been left in the SoccerSearchBean. The doGet function creates a SoccerSearchBean sets its search type from the request parameter data and invokes its doSearch method. Depending on the results of the search the doGet function uses one or other of the private auxiliary methods doSuccess or doSearchFail to deal with forwarding of the request to the appropriate JSP for final prettying up. The usual Servlet imports . and import soccer. public class PreprocessServlet extends HttpServlet Constant strings The first few are different forms of failure message that can be forwarded to a JSP that reports failed searches private static final String allstr We couldn t show you any results the season hasn t started private static final String drawstr There haven t been any drawn games yet this season. private static final String homestr There haven t been any home wins yet this season. private static final String awaystr There haven t been any away wins yet this season. These strings define the URLs for the JSPs that pretty up the final response. private static final String jspFailPage private static final String jspReportPage public void doGet HttpServletRequest request HttpServletResponse response throws ServletException IOException Get form data from request String search searchType Create and initialize the bean SoccerSearchBean ssb new SoccerSearchBean search Run the search Select appropriate reporting stage Servlet bean and JSP examples 365 if 0 doSearchFail search request response else doSuccess ssb request response private void doSearchFail String .

crossorigin="anonymous">
Đã 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.