2013-08-16 4 views
0

JBoss EAP 6.0에 JSF 2.1 + RichFaces 4.0 webapp가 있습니다. FacesMessage을 사용하여 bean에서 사용자 정의 오류 메시지를 표시 할 수 없습니다. addMessage()을 사용하여 메시지를 추가하려고합니다. 그러나 메시지는 <rich:messages>에 표시되지 않으며 내 콘솔에서 나는 점점 오전 :<rich : messages>에 전체 메시지가 표시되지 않습니다.

정보 [javax.enterprise.resource.webcontainer.jsf.renderkit] (HTTP-로컬 호스트/127.0.0.1 : 8888-3) 경고 : FacesMessage는 대기열에 있지만 표시되지 않았을 수 있습니다. sourceId = null [심각도 = (오류 2), 요약 = (모바일은 10도 이상이어야합니다.), detail =()].

보기 :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich"> 
    <ui:composition> 
     <h:head/> 
     <link href="../../css/styles.css" rel="stylesheet" type="text/css" />  
     <h:form id="personform12" > 
      <h:panelGrid id="test2343" width="80%"> 
       <rich:messages id="messages" globalOnly="true" errorClass="globalError" showSummary="true" showDetail="false"></rich:messages> 
      </h:panelGrid> 

      <h:panelGrid border="0" columns="3" width="90%" cellpadding="0" cellspacing="1" > 
       <h:panelGroup styleClass="alignmentRight"> 
        <h:outputText value="#{bundle['id']}" /> 
       </h:panelGroup> 
       <h:inputText id="id" value="#{personBean.pdto.id}" required="true"> 
       </h:inputText> 
       <rich:message styleClass="error" for="id" /> 

       <h:panelGroup> 
        <h:outputText value="#{bundle['name']}" /> 
       </h:panelGroup> 
       <h:inputText id="name" value="#{personBean.pdto.name}" required="true"/> 
       <rich:message styleClass="error" for="name" /> 

       <h:panelGroup styleClass="alignmentRight"> 
        <h:outputText value="city" /> 
       </h:panelGroup> 
       <h:inputText id="city" value="#{personBean.pdto.city}" required="true"/> 
       <rich:message styleClass="error" for="city" /> 

       <h:panelGroup styleClass="alignmentRight"> 
        <h:outputText value="state" /> 
       </h:panelGroup> 
       <h:inputText id="state" value="#{personBean.pdto.state}" required="true"/> 
       <rich:message styleClass="error" for="state" /> 

       <h:panelGroup styleClass="alignmentRight"> 
        <h:outputText value="mobile" /> 
       </h:panelGroup> 
       <h:inputText id="mobile" value="#{personBean.pdto.mobile}" required="true"> 
       </h:inputText> 
       <rich:message styleClass="error" for="mobile" /> 


       <h:panelGroup styleClass="alignmentRight"> 
        <h:outputText value="DOB" /> 
       </h:panelGroup> 
       <rich:calendar style="height:25px" inputStyle="width:203px" required="true" 
                showWeeksBar="false" 
                boundaryDatesMode="scroll" 
                id="dob" value="#{personBean.pdto.dob}" 
                datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" /> 
       <rich:message styleClass="error" for="dob" /> 
      </h:panelGrid> 

      <br/><br/> 
      <h:commandButton id="commandSubmit" value="Submit" action="#{personBean.save}"></h:commandButton> 
     </h:form> 
    </ui:composition> 
</html> 

모델 :

public class PersonJSFBean { 

    private static final Logger log = Logger.getLogger(PersonJSFBean.class); 
    private PersonDTO pdto; 
    private PersonManager personManager; 

    public String save(){ 
     String str = null; 
     try { 

      if(pdto.getMobile().length()<10) { 
       System.out.println("inside the mobile no>>>>>>>>>>>"+pdto.getMobile()); 
       FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "mobile no should be greater than 10 degits ", null); 
       FacesContext.getCurrentInstance().addMessage(null, facesMsg); 

      } 


     } catch (Exception e) { 
      System.out.println("Error occured>>>>>>>>>>>"); 
      e.printStackTrace(); 

     } 
     return str; 

    } 

    // ... 
} 

답변

0

UI에는 템플릿 속성이 존재하지 않는 것처럼 : 자재가 나는 페이지가 최상위 수준입니다 가정합니다. 이어서 H :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich"> 
    <h:head/> 
    <h:body> 
     <h:form ..... 
    </h:body> 
</html> 
: 본체
이 없거나, 현재 예는