新增错误提示
This commit is contained in:
parent
55e61ca5fe
commit
1ce4b97fd6
@ -215,6 +215,9 @@ public class DatabaseService {
|
||||
int count = rs.getInt(1);
|
||||
|
||||
if (count > 0) {
|
||||
if (count>1){
|
||||
throw new SQLException("Duplicate project found");
|
||||
}
|
||||
String updateSql = "UPDATE projects SET summary = ?, description = ?, keywords = ?, type = ?, collaborators = ?, link = ?, time = ? WHERE title = ? AND user_id = (SELECT id FROM users WHERE username = ?)";
|
||||
try (PreparedStatement updateStmt = conn.prepareStatement(updateSql)) {
|
||||
updateStmt.setString(1, project.getSummary());
|
||||
|
||||
@ -151,6 +151,7 @@ public class ProjectBean implements Serializable {
|
||||
context.addMessage("saveButton", new FacesMessage(FacesMessage.SEVERITY_INFO, "Submission Succeeded", null));
|
||||
loadAllKeywords();
|
||||
} catch (SQLException e) {
|
||||
context.addMessage("saveButton", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Submission Failed", null));
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "project";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user