示例#1
0
  public void loadStory() {
    if (!facesContext.getValidationFailed()) {
      NewsStory story = newsIndex.getStory(selectedStoryId);
      if (story != null) {
        selectedStory = story;
        return;
      }

      facesContext.addMessage(null, new FacesMessage("The headline you requested does not exist."));
    }

    // facesContext.getFlash().setKeepMessages(true); // only needed if navigation case is a
    // redirect
    facesContext
        .getApplication()
        .getNavigationHandler()
        .handleNavigation(facesContext, null, "/viewParameters/page01");
    // we would like the following instead
    // facesContext.fireNavigation("home");
  }
示例#2
0
 @PostConstruct
 public void postConstruct() {
   facesContext = FacesContext.getCurrentInstance();
   stories = new ArrayList<NewsStory>(newsIndex.getEntries().values());
 }