Đang chuẩn bị liên kết để tải về tài liệu:
Apress bắt đầu ứng dụng với java google - p 10

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

CHAPTER 4 ■ SERVLET CONTAINER AND FRAMEWORKS closeDate = df.parse(request.getParameter("closeDate")); } catch(java.text.ParseException pe) { System.out.println("Exception " + pe); } // create the new opportunity Opportunity opp = new Opportunity( request.getParameter("name"), new Double(request.getParameter("amount")).doubleValue(), request.getParameter("stageName"), new Integer(request.getParameter("probability")).intValue(), closeDate, new Integer(request.getParameter("orderNumber")).intValue(), new Long(request.getParameter("accountId")) ); // persist the entity try { pm.makePersistent(opp); } finally { pm.close(); } response.sendRedirect("telesales?action=accountDisplay&accountId="+request. getParameter("accountId")); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } 68 CHAPTER 4 ■ SERVLET CONTAINER AND FRAMEWORKS ■ Note The servlet in Listing 4-8 describes code for. | CHAPTER 4 SERVLET CONTAINER AND FRAMEWORKS closeDate df.parse request.getParameter closeDate catch java.text.ParseException pe System.out.println Exception pe create the new opportunity Opportunity opp new Opportunity request.getParameter name new Double request.getParameter amount .doubleValue request.getParameter stageName new Integer request.getParameter probability .intValue closeDate new Integer request.getParameter orderNumber .intValue new Long request.getParameter accountId persist the entity try pm.makePersistent opp finally pm.close response.sendRedirect telesales action accountDisplay accountId request. getParameter accountId public void doPost HttpServletRequest request HttpServletResponse response throws ServletException lOException doGet request response 68 CHAPTER 4 SERVLET CONTAINER AND FRAMEWORKS Note The servlet in Listing 4-8 describes code for interacting with Bigtable. We ll provide more details on the PersistenceManager JDO and JDOQL in Chapter 7. Deployment Descriptor When the web server receives a request for your application it uses the deployment descriptor to map the URL of the request to the code handling the request. Modify the web.xml file with the code in Listing 4-9 to use the TelesalesServlet class. The servlet mapping specifies that all incoming requests to telesales be mapped to the newly created servlet defined in the servlet definition. Listing 4-9. The web.xml file xml version 1.0 encoding utf-8 DOCTYPE web-app PUBLIC - Sun Microsystems Inc. DTD Web Application 2.3 EN http java.sun.com dtd web-app_2_3.dtd web-app xmlns http java.sun.com xml ns javaee version 2.5 servlet servlet-name telesales servlet-name servlet-class com.appirio.TelesalesServlet servlet-class servlet servlet-mapping servlet-name telesales servlet-name url-pattern telesales url-pattern servlet-mapping welcome-file-list welcome-file index.html welcome-file welcome-file-list web-app PersistenceManager The servlet utilizes Bigtable to store data for your .

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