修复IDE生成的getter的问题;添加登录等按钮
This commit is contained in:
parent
a26818f107
commit
7e25024e3e
@ -24,7 +24,7 @@ public class ProjectBean implements Serializable {
|
|||||||
private UserInfo userInfo; // User info for the current user
|
private UserInfo userInfo; // User info for the current user
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
private boolean isLoggedIn = false;
|
private Boolean isLoggedIn = false;
|
||||||
public String projectKeywords = ""; // String to hold project keywords
|
public String projectKeywords = ""; // String to hold project keywords
|
||||||
public String newKeyword = "";
|
public String newKeyword = "";
|
||||||
public String projectCollaborators = ""; // String to hold project collaborators
|
public String projectCollaborators = ""; // String to hold project collaborators
|
||||||
@ -126,7 +126,11 @@ public class ProjectBean implements Serializable {
|
|||||||
try {
|
try {
|
||||||
ArrayList<Project> newProject = new ArrayList<>();
|
ArrayList<Project> newProject = new ArrayList<>();
|
||||||
newProject.add(project);
|
newProject.add(project);
|
||||||
|
if (projects.isEmpty()) {
|
||||||
|
projects.add(project);
|
||||||
|
} else {
|
||||||
projects.set(projectIdx, project);
|
projects.set(projectIdx, project);
|
||||||
|
}
|
||||||
databaseService.saveProjects(username, newProject);
|
databaseService.saveProjects(username, newProject);
|
||||||
context.addMessage("saveButton", new FacesMessage(FacesMessage.SEVERITY_INFO, "Submission Succeeded", null));
|
context.addMessage("saveButton", new FacesMessage(FacesMessage.SEVERITY_INFO, "Submission Succeeded", null));
|
||||||
loadAllKeywords();
|
loadAllKeywords();
|
||||||
@ -252,11 +256,7 @@ public class ProjectBean implements Serializable {
|
|||||||
this.newKeyword = newKeyword;
|
this.newKeyword = newKeyword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoggedIn() {
|
public Boolean getIsLoggedIn() {
|
||||||
return isLoggedIn;
|
return isLoggedIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoggedIn(boolean loggedIn) {
|
|
||||||
isLoggedIn = loggedIn;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,13 @@
|
|||||||
<li><h:link value="Edit Projects" outcome="edit" rendered="#{not empty projectBean.username}"/></li>
|
<li><h:link value="Edit Projects" outcome="edit" rendered="#{not empty projectBean.username}"/></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
<div style="position: absolute; top: 10px; right: 10px;">
|
||||||
|
<h:form>
|
||||||
|
<h:commandButton value="register" action="register" rendered="#{not projectBean.isLoggedIn}"/>
|
||||||
|
<h:commandButton value="login" action="login" rendered="#{not projectBean.isLoggedIn}"/>
|
||||||
|
<h:commandButton value="logout" action="#{projectBean.logout}" rendered="#{projectBean.isLoggedIn}"/>
|
||||||
|
</h:form>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
</h:body>
|
</h:body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user