The second test will be given in class on Wednesday, April 1. The test material starts with AJAX and Prototype and ends with SQL and MySQL. It will not cover JDBC. Material on Servlets, JSP, sessions, MySQL, and SQL is covered in Chapters 5, 6, 7, 8, and 13 of Murach's Java Servlets and JSP. In addition to all this, we spent a bit of time on the HTTP protocol. The test is cumulative to the extent that new material depends on old material, but the test will be directed towards things that have been covered since the first test.
You might be asked to write all or part of a JSP page. You will not need to remember the complete syntax for a servlet class, but you might have to fill in the code in the servlet method that responds to a request. You might have to write some fairly simple SQL commands. This page lists the JSP/servlet/SQL syntax details that you are expected to be able to use.
Of course, you can also expect some short and some longer essay-type questions. The rest of this page lists some of the things you should know
AJAX and Web 2.0 HTTP: a stateless request/response protocol How cookies, hidden fields, and URL rewriting are used to get information from one page request to another Sessions, and why they are necessary J2EE Tomcat, and J2EE servers in general; services that they provide The MVC (Model/View/Controller) pattern and its advantages How J2EE web applications can implement the MVC pattern the difference between forwarding and redirecting in a servlet or JSP Databases, relational databases, and RDBMS Database indexes and why they are used
the $(id) function in Prototype how to send an AJAX request using Prototype: new Ajax.Request( url, { parameters: { param1: value2, param2: value2, ... }, onSuccess: function(resp) { ... }, onFailure: function() { ... } }); using resp.responseText in an AJAX onSuccess function what it means to say that an AJAX request is asynchronous how the web browser and web server interact to process an AJAX request how AJAX depends on the DOM
the WEB-INF directory in a web application servlets the doPost and doGet methods (both mapped to doResponse in NetBeans) JSP pages roles of servlets, JSPs, and data access classes in an MVC application predefined variables on a JSP page: application, session, request, out obtaining the session in a servlet: request.getSession() -- type HttpSession attributes; the setAttribute(k,v) and getAttribute(k) methods of the session and request objects how attributes are used to carry information from one JSP/servlet to another how session attributes are used to store session data how to implement user login and how to track the user through a session using session.invalidate() to end a session mixing HTML and Java on a JSP page: <% ---java code--- %> <%= --java value-- %> <%! --declarations-- %> why instance variables are a bad idea in a servlet or JSP the <@page import="---java classes---"%> directive using out.println() in Java code on a JSP page HTML forms on JSP pages; using a servlet as the action in a form validating data from HTML forms (on the client side and on the server side) the request.getParameter(k) method and its relation to forms
SQL (Structured Query Language): a language for querying relational databases relational database tables column names and data types common SQL data types: int, float, varchar(N), text, datetime, timestamp primary keys auto_increment columns index for a column how column names are used in conditions and other expressions in SQL how to read and understand a CREATE TABLE statement, including: primary key, auto_increment, index, not null syntax for inserting a row into a database table: INSERT INTO <table_name> (<column1>,...,<columnN>) VALUES (<value1>,...,<valueN>) INSERT INTO <table_name> VALUES (<value1>,...,<valueN>) syntax for deleting rows from a database table: DELETE FROM <table_name> WHERE <condition> syntax for modifying rows in a database table: UPDATE <table_name> SET <column_name> = <expression> WHERE <condition> basic syntax for getting data from a single table: SELECT * FROM <table_name> WHERE <condition> SELECT <column1>, ..., <columnN> FROM <table_name> WHERE <condition> SELECT <column1>, ..., <columnN> FROM <table_name> WHERE <condition> ORDER BY <column_name> SELECT count(*) from <table_name> WHERE <condition> why SELECTSs from multiple tables are sometimes necessary