getString(2) + ?????? + ???
???
+
rs.getString(3) + ?????? + ???
???
+
34 2 Developing an Ajax Web Application
rs.getString(4) + ?????? + ???
??? +
rs.getString(5) + ?????? + ???
??? +
rs.getString(6) + ?????? + ??????);
} else {
out.println(???
true???);
}
rs.close();
stmt.close();
conn.close();
} catch (javax.naming.NamingException e) {
} catch (SQLException e) {
}
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
try {
//Obtain Connection
InitialContext initialContext = new
InitialContext();
javax.sql.DataSource ds =
(javax.sql.DataSource)
initialContext.lookup(???java:comp/env/jdbc/AjaxConn
ectionDS???);
java.sql.Connection conn = ds.getConnection();
String catalogId =
request.getParameter(???catalogId???);
String journal = request.getParameter(???journal???);
String publisher =
request.getParameter(???publisher???);
String edition = request.getParameter(???edition???);
String title = request.getParameter(???title???);
String author = request.getParameter(???author???);
Statement stmt = conn.createStatement();
String sql = ???INSERT INTO Catalog VALUES(??? + ???\??™???
+ catalogId +
???\??™??? + ???,??? + ???\??™??? + journal + ???\??™??? +
???,??? + ???\??™??? + publisher +
???\??™??? + ???,??? + ???\??™??? + edition + ???\??™??? +
???,??? + ???\??™??? + title + ???\??™??? +
???,??? + ???\??™??? + author + ???\??™??? + ???)???;
stmt.
Pages:
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54