From 7e25024e3e96baaa57c2f16a029ab5f050f02ce0 Mon Sep 17 00:00:00 2001 From: heshunme Date: Sun, 14 Jul 2024 15:24:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIDE=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84getter=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=99=BB=E5=BD=95=E7=AD=89=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/web/web_assignment/ProjectBean.java | 14 +++++++------- src/main/webapp/header.xhtml | 7 +++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/web/web_assignment/ProjectBean.java b/src/main/java/com/web/web_assignment/ProjectBean.java index 9a8daef..da9c043 100644 --- a/src/main/java/com/web/web_assignment/ProjectBean.java +++ b/src/main/java/com/web/web_assignment/ProjectBean.java @@ -24,7 +24,7 @@ public class ProjectBean implements Serializable { private UserInfo userInfo; // User info for the current user private String username; private String password; - private boolean isLoggedIn = false; + private Boolean isLoggedIn = false; public String projectKeywords = ""; // String to hold project keywords public String newKeyword = ""; public String projectCollaborators = ""; // String to hold project collaborators @@ -126,7 +126,11 @@ public class ProjectBean implements Serializable { try { ArrayList newProject = new ArrayList<>(); newProject.add(project); - projects.set(projectIdx,project); + if (projects.isEmpty()) { + projects.add(project); + } else { + projects.set(projectIdx, project); + } databaseService.saveProjects(username, newProject); context.addMessage("saveButton", new FacesMessage(FacesMessage.SEVERITY_INFO, "Submission Succeeded", null)); loadAllKeywords(); @@ -252,11 +256,7 @@ public class ProjectBean implements Serializable { this.newKeyword = newKeyword; } - public boolean isLoggedIn() { + public Boolean getIsLoggedIn() { return isLoggedIn; } - - public void setLoggedIn(boolean loggedIn) { - isLoggedIn = loggedIn; - } } diff --git a/src/main/webapp/header.xhtml b/src/main/webapp/header.xhtml index 371c2e2..a7506c5 100644 --- a/src/main/webapp/header.xhtml +++ b/src/main/webapp/header.xhtml @@ -20,6 +20,13 @@
  • +
    + + + + + +