public String confirmAddNewSurvey() { FacesContext context = FacesContext.getCurrentInstance(); newSurvey.setDatecreated(Calendar.getInstance().getTime()); newSurvey = surveyManager.saveSurvey(newSurvey); editSurveySession.refreshSurveyList(); String msg = "New survey: \"" + newSurvey.getSurveytitle() + "\" added."; context.getExternalContext().getFlash().putNow("msg", msg); return "editSurvey"; }
public void addNewSurvey() { RequestContext rqContext = RequestContext.getCurrentInstance(); if (surveyManager.loadSurveyBySurveyTitle(newSurvey.getSurveytitle()) != null) { warnPopContent = "Cannot create survey, survey with the same name already exist."; rqContext.execute("warndl.show()"); } else { rqContext.execute("confirmAddSurveyDialog.show()"); } }