问题
i am using rich notify messages and added all related jars namely
richfaces-components-ui-4.1.0.Final ,
richfaces-core-impl-4.0.0.Final,
standard-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,
guava-r08,
jhighlight-1.0.
but i am getting class not found exception:org.richfaces.component.NotifyAttributes.
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
i am not getting why this is getting although i added all required jars of richfaces4.0 and above.
回答1:
notify
component is not part of RichFaces 4.0. See Richfaces 4.0 VDL documentation. You have to use version 4.1 or up (for example current version RichFaces 4.3).
Note: all richfaces-???.jar(s) should be for the same version of RichFaces.
来源:https://stackoverflow.com/questions/21300900/jars-required-to-be-added-to-use-rich-notify-messages-in-jsf