// ------------------------------------------------------
// edit.html
//
// Job Editor. Used to edit or create jobs.
//
// Copyright (c) 1998. Stephen M. Bate,
// Object Computing, Inc. All rights reserved.
//
// This software is being provided by the copyright
// holder under the following license. By obtaining, using
// and/or copying this software, you agree that you have
// read, understood, and will comply with the following
// terms and conditions:
//
// Permission to use, copy, modify, and distribute this
// software and its documentation for any purpose and
// without fee or royalty is hereby granted, provided that
// the full text of this NOTICE appears on ALL copies of
// the software and documentation or portions thereof,
// including modifications, that you make.
//
// THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
// MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
// IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION,
// COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES
// OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE
// OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT
// INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS
// OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL BEAR NO
// LIABILITY FOR ANY USE OF THIS SOFTWARE OR DOCUMENTATION.
//
// Title to copyright in this software and any associated
// documentation will at all times remain with copyright
// holder.
Edit Job
// ------------------------------------------------------
// See index.jhtml for more details about import and extends.
java.sql.*
org.phxjug.db.DatabaseServlet
[Job Maintenance]
[Job Listings]
// Parameters and db data used to process the form.
// The values are set after the JDBC query below.
String action = null;
String title = null;
String description = null;
long timetag = 0;
String id = null;
// Check for remote user. See maintain.jhtml for more
// discussion about the remote user and authentification.
String user = null;
if ((user = request.getRemoteUser()) == null) {
out.println("Error: No remote user");
log("no remote user");
}
else {
if ((id = request.getParameter("id")) != null) {
//
// If we were given an id, this is an edit operation.
//
Connection con = null;
PreparedStatement stmt = null;
ResultSet result = null;
try {
con = getConnection();
stmt = con.prepareStatement("select * from job where " +
"id = ? and active = 'Y'");
stmt.setString(1, id);
result = stmt.executeQuery();
// should only be one job since id is a primary key.
result.next();
title = result.getString("abstract");
description = result.getString("description");
timetag = result.getTimestamp("timetag").getTime();
action = "edit";
}
catch (Exception e) {
getServletContext().log(e, "query failed");
}
finally {
try {
if (stmt != null) stmt.close();
if (result != null) result.close();
}
catch (Exception e) {
getServletContext().log(e, "query cleanup failed");
}
// release the connection the db connection pool.
// (base class operation)
freeConnection(con);
}
}
else {
//
// No id, so this is a create operation.
//
action = "create";
timetag = new java.util.Date().getTime();
}
Edit Job (user: user):
} // if user != null
// ------------------------------------------------------
// Include the common footer. The footer is placed in the
// /_private/jws_footer.html file and can be included
// from any jhtml pages on the web site.