经过大量研究,我能够在 Google Appengine 中插入一条记录,如下所示。但是,现在我遇到了一个问题:我无法使用遵循 GQL 或 SQL 语法的查询来编辑记录。请帮忙!
public class AppointmentServlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
Date dateLog = new Date();
String merchant = req.getParameter("merchant");
String date = req.getParameter("date");
String time = req.getParameter("time");
String strDateTime = date + " " + time;
Date dateTime = null;
try {
dateTime = new SimpleDateFormat("dd/MM/yyyy HH:mm").parse(strDateTime);
} catch (ParseException e) {
}
String service = req.getParameter("service");
String personnel = "Internet Booking";
String name = req.getParameter("name");
String phone = req.getParameter("phone");
String email = req.getParameter("email");
String request = req.getParameter("request");
if(email.isEmpty()) {
email = "-";
}
if(request.isEmpty()) {
request = "-";
}
Appointment appt = new Appointment(dateLog, merchant, dateTime, service, personnel, name, phone, email, request);
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
pm.makePersistent(appt);
} finally {
pm.close();
}
resp.sendRedirect("/appointment/complete.jsp");
}
}
我有一个“编辑”表单,可以在其中编辑任何字段。所以请帮忙!谢谢!