Get the validation message for a specific component

前端 未结 2 1233
日久生厌
日久生厌 2021-01-14 13:48


        
2条回答
  •  不知归路
    2021-01-14 14:44

    How about this java method

    public String getComponentMessageDetail(String cid){
      FacesContext ctxt  =  FacesContext.getCurrentInstance();
      Iterator cm = ctxt.getMessages(cid);
      List msg = new ArrayList<>();
      while(cm.hasNext()) {
        msg.add(cm.next().getDetail());
      }
      return String.join(" | ", msg);
    }
    

    to show everything what's in the message cache?

    Also in xhtml

    
                                                            
提交回复
热议问题