2014-01-23 84 views
0

我使用丰富的通知消息,并添加所有相关罐子即
richfaces-components-ui-4.1.0.Final
richfaces-core-impl-4.0.0.Final
标准-1.1.2
JSTL-1.2
validation-api-1.0.0.GA
richfaces-core-api-4.0.0.Final
richfaces-components-api-4.0.0.Final
JSF的参数impl-2.0.2
cssparser-0.9.5
番石榴-R08
jhighlight-1.0。
但我没有找到类没有发现异常:org.richfaces.component.NotifyAttributes。需要添加jar才能在jsf中使用丰富的通知消息?

sample.xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <ui:composition 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"> 
     <rich:panel> 
      <f:facet name="header"> 
       <h:outputText value="Validation Form" /> 
      </f:facet> 
      <h:form> 
       <h:panelGrid columns="3"> 
        <rich:validator event="change"> 
         <h:outputText value="Name:" /> 
         <h:inputText label="Name" id="name" value="#{userBean.name}" 
          required="true"> 
          <f:validateLength minimum="3" /> 
         </h:inputText> 
         <rich:message for="name" ajaxRendered="true" /> 
         <h:outputText value="Job:" /> 
         <h:inputText label="Job" id="job" value="#{userBean.job}" 
          requiredMessage="Job is required"> 
          <f:validateLength minimum="3" maximum="50" /> 
         </h:inputText> 
         <rich:message for="job" ajaxRendered="true" /> 
         <h:outputText value="Address:" /> 
         <h:inputText label="Address" id="address" 
          value="#{userBean.address}" requiredMessage="Address is required"> 
          <f:validateLength minimum="10" /> 
         </h:inputText> 
         <rich:message for="address" ajaxRendered="true" /> 
         <h:outputText value="Zip:" /> 
         <h:inputText label="Zip" id="zip" value="#{userBean.zip}" 
          requiredMessage="Zip is required"> 
          <f:validateLength minimum="4" maximum="9" /> 
         </h:inputText> 
         <rich:message for="zip" ajaxRendered="true" /> 
        </rich:validator> 
        <rich:notifyMessages stayTime="2000" nonblocking="true" escape="false"/> 
        <f:facet name="footer"> 
         <a4j:commandButton value="Ajax Validate" /> 
        </f:facet> 
       </h:panelGrid> 
      </h:form> 
     </rich:panel> 
    </ui:composition> 

bean class used to set and get bean vlaues.let me know whats wrong with existing code ,along with jars to be added 
    userBean.java: 

    import javax.faces.bean.ManagedBean; 
    import javax.faces.bean.SessionScoped; 

    @ManagedBean 
    @SessionScoped 
    public class userBean { 
     private String name; 
     private String job; 
     private String address; 
     private String zip; 
     public String getName() { 
      return name; 
     } 
     public void setName(String name) { 
      this.name = name; 
     } 
     public String getJob() { 
      return job; 
     } 
     public void setJob(String job) { 
      this.job = job; 
     } 
     public String getAddress() { 
      return address; 
     } 
     public void setAddress(String address) { 
      this.address = address; 
     } 
     public String getZip() { 
      return zip; 
     } 
     public void setZip(String zip) { 
      this.zip = zip; 
     } 

    } 



error: 
    Caused by: java.lang.ClassNotFoundException: org.richfaces.component.NotifyAttributes 

我没有得到这是为什么越来越虽然我添加了所有必需的richfaces4.0及以上的罐子。

回答

1

notify组件不是RichFaces 4.0的一部分。请参阅Richfaces 4.0 VDL documentation。您必须使用4.1或更高版本(例如当前版本的RichFaces 4.3)。
注意:所有richfaces - ???。jar(s)应该用于RichFaces的相同版本

相关问题