34.1 | What is the common gateway interface? |
34.2 | What are the differences between the GET and POST methods in an HTML form? |
34.3 | Can you submit a GET request directly from a URL? Can you submit a POST request directly from a URL? |
34.4 | What is wrong in the following URL for submitting a GET request to the servlet FindScore on host liang at port 8080 with parameter name ? http://liang:8080/FindScore?name="P Yates" |
34.5 | What are the differences between CGI and servlets? |
34.6 | Can you display an HTML file (e.g., c:\test.html ) by typing the complete file name in the Address field of Internet Explorer? Can you run a servlet by simply typing the servlet class file name? |
34.7 | Before you start Tomcat, what value should be set to the environment variable JAVA_HOME ? |
34.8 | How do you start Tomcat? How do you stop Tomcat? |
34.9 | How do you test whether Tomcat is running? |
34.10 | To compile a servlet program, what library file has to be included in the classpath? |
34.11 | When you run Tomcat, which port does it use? What happens if the port is already in use? |
34.12 | Describe the life cycle of a servlet. |
34.13 | Suppose that you started Tomcat, ran the following servlet twice by issuing an appropriate URL from a Web browser, and finally stopped Tomcat. What was displayed on the console when the servlet was first invoked? What was displayed on the console when the servlet was invoked for the second time? What was displayed on the console when Tomcat was shut down? import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class Test extends HttpServlet { public Test() { System.out.println( "Constructor called" ); } /** Initialize variables */ public void init() throws ServletException { System.out.println( "init called" ); } /** Process the HTTP Get request */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println( "doGet called" ); } /** Clean up resources */ public void destroy() { System.out.println( "destroy called" ); } } |
34.14 | What would be displayed if you changed the content type to "html/plain" in Listing 34.2, CurrentTime.java? |
34.15 | The statement out.close() is used to close the output stream to response. Why isn't this statement enclosed in a try-catch block? |
34.16 | What happens when you invoke request.getParameter(paramName) if paramName does not exist? |
| |
34.17 | How do you write a text field, combo box, check box, and text area in an HTML form? |
34.18 | How do you retrieve the parameter values for a text field, combo box, list, check box, radio button, and text area from an HTML form? |
34.19 | If the servlet uses a database driver other than the JDBC-ODBC driver, where should the driver be placed? |
34.20 | What is session tracking? What are three techniques for session tracking? |
34.21 | How do you create a cookie, send a cookie to a browser, get cookies from a browser, get the name of a cookie, set a new value in the cookie, and set cookie expiration time? |
34.22 | How do you get a session, set object value for the session, and get object value from the session? |
34.23 | What output stream should you use to send images to the browser? What content type do you have to set for the response? |
34.24 | How do you deal with dynamic contents with images and text? |