tailieunhanh - java programming language basics phần 3

Các ví dụ cho bài học này bao gồm hai phiên bản của khách hàng và một cặp chương trình máy chủ được chuyển thể từ các ứng dụng trình bày trong Phần 1, Bài 6: File Access và Quyền. | Java TM Language Basics Parti Lesson 5 Writing Servlets http Programming BasicJava1 The HTML form is embedded in this HTML file. The diagram shows how the HTML page looks when it is opened in a browser. I m a Simple Form Enter some text and click the Submit button. Clicking Submit invokes ExampServ let java which returns an HTML page to the browser. Click MeI Reset and returns an HTML page with the text. The HTML file and form are similar to the simple application and applet examples in Lesson 4 so you can compare the code and learn how servlets applets and applications handle end user inputs. When the user clicks the Click Me button the servlet gets the entered text The HTML page returned to the browser by the servlet is shown below. The servlet code to retrieve the user s input and generate the HTML page follows with a discussion. Button Clicked Fourscore and seven years ago Return to Form Note To run the example you have to put the servlet and HTML files in the correct directories for the Web server you are using. For example with Java Webserver you place the servlet in the servlets and the HTML file in the public_html directory. Servlet Backend builds an HTML page to return to the end user. This means the servlet code does not use any Project Swing or Abstract Window Toolkit AWT components or have event handling code. For this simple servlet you only need to import these packages for system input and output. The HttpServlet class uses the IOException class in this package to signal that an input or output exception of some kind has occurred. which contains generic protocol-independent servlet classes. The HttpServlet class uses the ServletException class in this package to indicate a servlet problem. which contains HTTP servlet classes. The HttpServlet class is in this package. import .

TỪ KHÓA LIÊN QUAN