1

我正在使用 JSF2、PrimeFaces、Spring、Hibernate 开发应用程序。在控制台中不存在/显示任何错误。但是,某些 PrimeFaces 组件无法正常工作。我认为它与图书馆不兼容,但我没有发现哪个(S)。下面是我的库:

aspectjrt-1.6.8.jar
c3p0-0.9.1.jar
commons-beanutils-1.8.0.jar
commons-codec-1.7.jar
commons-collections-3.2.1.jar
commons-digester-1.8.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-logging-1.1.1.jar
dom4j-1.6.1.jar
ehcache-core-2.4.3.jar
ejb3-persistence.jar
hibernate-c3p0-4.1.7.Final.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.1.7.Final.jar
hibernate-ehcache-4.1.7.Final.jar
hibernate-entitymanager-4.1.7.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
itext-2.1.7.jar
javassist-3.15.0-GA.jar
javax.faces-2.1.17.jar
jboss-logging-3.1.0.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
jstl.jar
jta-1.1.jar
org.springframework.aop-3.1.2.RELEASE.jar
org.springframework.asm-3.1.2.RELEASE.jar
org.springframework.aspects-3.1.2.RELEASE.jar
org.springframework.beans-3.1.2.RELEASE.jar
org.springframework.context-3.1.2.RELEASE.jar
org.springframework.core-3.1.2.RELEASE.jar
org.springframework.expression-3.1.2.RELEASE.jar
org.springframework.jdbc-3.1.2.RELEASE.jar
org.springframework.jms-3.1.2.RELEASE.jar
org.springframework.orm-3.1.2.RELEASE.jar
org.springframework.oxm-3.1.2.RELEASE.jar
org.springframework.transaction-3.1.2.RELEASE.jar
org.springframework.web-3.1.2.RELEASE.jar
poi-3.7.jar
postgresql-9.1-902.jdbc4.jar
primefaces-3.4.1.jar
rome-1.0.jar
slf4j-api-1.5.2.jar
slf4j-nop-1.5.2.jar
spring-security-acl-3.1.3.RELEASE.jar
spring-security-core-3.1.3.RELEASE.jar
spring-security-taglibs-3.1.3.RELEASE.jar

非常感谢!:)

编辑

这是不工作的组件之一。它应该返回给我碳粉名称和型号:

<p:selectOneMenu id="modeloToner" value="#{tonerBean.modeloToner}">
    <p:ajax update="form:impressorasCompativeis" listener="#tonerBean.findImpressorasCompativeis}" process="form:modeloToner" />
    <f:selectItem itemLabel="Selecione..." itemValue="Nenhum" />
    <f:selectItems value="#{tonerBean.listModeloToner}" />
</p:selectOneMenu>

生成的 HTML,它具有值但不工作。其他组件也不工作。

<select id="form:modeloToner_input" name="form:modeloToner_input">
    <option value="Nenhum">Selecione...</option>
    <option value="HP 530">HP 530</option>
    <option value="HP 532" selected="selected">HP 532</option>
    <option value="HP 53X">HP 53X</option>
    <option value="Lexmark 12738826">Lexmark 12738826</option>
   <option value="Samsung 208L">Samsung 208L</option>
</select>
4

1 回答 1

1

我认为您的 p:selectOneMenu 没有返回值,因为它没有转换器。改进您对其他组件的问题,让我们尝试解决

<p:selectOneMenu id="modeloToner" value="#{tonerBean.modeloToner}" converter="converter">
    <p:ajax update="form:impressorasCompativeis" listener="#tonerBean.findImpressorasCompativeis}" process="form:modeloToner" />
     <f:selectItem itemLabel="Selecione..." itemValue="Nenhum" />
     <f:selectItems value="#{tonerBean.listModeloToner}" />
</p:selectOneMenu>

和转换器类

@FacesConverter(value="converter")
public class Converter implements Converter {

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    YourObject o = new YourObject();
    // some operations to set the parameters of Object based on the String
    return location;
}

@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
    YourObject o = (YourObject) value;
    String string;
    // some operations to save the parameters of Object into a String
    return string;
}
}
于 2013-03-05T21:13:57.867 回答