コード例 #1
0
 /**
  * This method just shows another approach to adding a status message.
  *
  * <p>Invoked by:
  *
  * <p>
  *
  * <pre>
  * &lt;f:event type="preRenderView" listener="#{register.notifyIfDeletingIsInvalid}"/>
  * </pre>
  */
 public void notifyIfDeletingIsInvalid() {
   if (facesContext.isValidationFailed()) {
     messages
         .warn(new DefaultBundleKey("receipt_invalid"))
         .defaults("Invalid receipt. Please correct the errors and try again.");
   }
 }
コード例 #2
0
 /**
  * This method just shows another approach to adding a status message.
  *
  * <p>Invoked by:
  *
  * <p>
  *
  * <pre>
  * &lt;f:event type="preRenderView" listener="#{register.notifyIfRegistrationIsInvalid}"/>
  * </pre>
  */
 public void notifyIfRegistrationIsInvalid() {
   if (facesContext.isValidationFailed() || registrationInvalid) {
     messages
         .warn(new DefaultBundleKey("magazzino_invalid"))
         .defaults("Invalid jar. Please correct the errors and try again.");
   }
 }
コード例 #3
0
  private boolean verifyNumberIsAvailable() {
    Magazzino existing = em.find(Magazzino.class, newJar.getCodeJar());
    if (existing != null) {
      messages
          .warn(new BundleKey("messages", "account_numberTaken"))
          .defaults("The number '{0}' is already taken. Please choose another number.")
          .targets(numberInput.getClientId())
          .params(newJar.getCodeJar());
      log.jarAvailable(existing.getCodeJar() + "", existing != null);
      return false;
    }

    return true;
  }