Package javax.faces.context

Examples of javax.faces.context.FacesContext.addMessage()


                           new FacesMessage("Successfully serialized " + writing.getValue() + " [at " + writing.getKey() + "]"));
      }
    }
    catch (IOException ioe)
    {
      context.addMessage(null,
           new FacesMessage(FacesMessage.SEVERITY_ERROR,
                            "Failed while outputting object " + writing.getValue()  +
                            " [at " + writing.getKey() + "]",
                            ioe.getMessage()));
    }
View Full Code Here


    String oldValue = _toString(vce.getOldValue());
    Object newValue = _toString(vce.getNewValue());
    FacesContext context = FacesContext.getCurrentInstance();
    String message =
      "Value changed from " + oldValue + " to " + newValue;
    context.addMessage(vce.getComponent().getClientId(context),
                       new FacesMessage(message));
  }

  public Integer getSingleInt()
  {
View Full Code Here

   
    String message =  "Range changed from "
                      + oldStart +"-"+oldEnd+" to "
                      + newStart +"-"+newEnd;
                     
    context.addMessage(rce.getComponent().getClientId(context),
                       new FacesMessage(message));
                      
    _setStart(newStart);
    _setEnd(newEnd);
    _setNamesInRange(getNames().subList(_start, getEnd()));   
View Full Code Here

  public String doCreateBook() {
    FacesContext ctx = FacesContext.getCurrentInstance();

    if (book.getIsbn() == null || "".equals(book.getIsbn())) {
      ctx.addMessage("bookForm:isbn", new FacesMessage(FacesMessage.SEVERITY_WARN,
              "Wrong isbn", "You should enter an ISBN number"));
    }
    if (book.getTitle() == null || "".equals(book.getTitle())) {
      ctx.addMessage("bookForm:title", new FacesMessage(FacesMessage.SEVERITY_WARN,
              "Wrong title", "You should enter a title for the book"));
View Full Code Here

    if (book.getIsbn() == null || "".equals(book.getIsbn())) {
      ctx.addMessage("bookForm:isbn", new FacesMessage(FacesMessage.SEVERITY_WARN,
              "Wrong isbn", "You should enter an ISBN number"));
    }
    if (book.getTitle() == null || "".equals(book.getTitle())) {
      ctx.addMessage("bookForm:title", new FacesMessage(FacesMessage.SEVERITY_WARN,
              "Wrong title", "You should enter a title for the book"));
    }

    if (ctx.getMessageList().size() != 0)
      return null;
View Full Code Here

    if (ctx.getMessageList().size() != 0)
      return null;

    try {
      book = bookEJB.createBook(book);
      ctx.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Book created",
              "The book" + book.getTitle() + " has been created with id=" + book.getId()));
    } catch (Exception e) {
      ctx.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,
              "Book hasn't been created", e.getMessage()));
    }
View Full Code Here

    try {
      book = bookEJB.createBook(book);
      ctx.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Book created",
              "The book" + book.getTitle() + " has been created with id=" + book.getId()));
    } catch (Exception e) {
      ctx.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,
              "Book hasn't been created", e.getMessage()));
    }
    return null;
  }
View Full Code Here

                            FacesMessages.UIINPUT_UPDATE, MessageUtil.getLabel(facesContext, this));
                } else {
                    message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr);
                }
                facesContext.getExternalContext().log(message.getSummary(), result);
                facesContext.addMessage(getClientId(facesContext), message);
                facesContext.renderResponse();
            } catch (IllegalArgumentException e) {
                FacesMessage message = ServiceTracker.getService(MessageFactory.class).createMessage(facesContext,
                        FacesMessages.UIINPUT_UPDATE, MessageUtil.getLabel(facesContext, this));
                facesContext.getExternalContext().log(message.getSummary(), e);
View Full Code Here

                facesContext.renderResponse();
            } catch (IllegalArgumentException e) {
                FacesMessage message = ServiceTracker.getService(MessageFactory.class).createMessage(facesContext,
                        FacesMessages.UIINPUT_UPDATE, MessageUtil.getLabel(facesContext, this));
                facesContext.getExternalContext().log(message.getSummary(), e);
                facesContext.addMessage(getClientId(facesContext), message);
                facesContext.renderResponse();
            } catch (Exception e) {
                FacesMessage message = ServiceTracker.getService(MessageFactory.class).createMessage(facesContext,
                        FacesMessages.UIINPUT_UPDATE, MessageUtil.getLabel(facesContext, this));
                facesContext.getExternalContext().log(message.getSummary(), e);
View Full Code Here

                facesContext.renderResponse();
            } catch (Exception e) {
                FacesMessage message = ServiceTracker.getService(MessageFactory.class).createMessage(facesContext,
                        FacesMessages.UIINPUT_UPDATE, MessageUtil.getLabel(facesContext, this));
                facesContext.getExternalContext().log(message.getSummary(), e);
                facesContext.addMessage(getClientId(facesContext), message);
                facesContext.renderResponse();
            }
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.