primefaces selectOneListbox更改事件

时间:2019-02-17 15:13:50

标签: primefaces

为什么在我的托管bean中没有调用“ symbolChanged”?另外,graphTitle也不改变。

<p:outputLabel id="graphTitle" value="#{simulationBean.graphTitle}" />
<p:selectOneListbox 
    id="symbolPicker" 
    value="#{simulationBean.company}" 
    converter="companyConverter" 
    var="t" 
    filter="true" 
    filterMatchMode="contains">

        <f:selectItems value="#{simulationBean.companies}" var="company" itemLabel="#{company.symbol}" itemValue="#{company}" />

        <p:column>
            <h:outputText value="#{t.symbol}" />
        </p:column>

        <p:ajax update="graphTitle" partialSubmit="false" listener="#{simulationBean.symbolChanged}" event="change" />
</p:selectOneListbox>

这是bean的方法:

public void symbolChanged(final AjaxBehaviorEvent event) {
    String name = (String) ((UIOutput) event.getSource()).getValue();
    setSymbol(name);
}

@Kukeltje,我尝试了其他活动,例如blabla。那些会在eclipse(以及页面本身)中出错。当我尝试使用“ change”或“ valueChange”时,eclipse在其输出中什么也没显示。

2019-02-17 11:10:02.469 ERROR 5472 --- [nio-8080-exec-7] j.e.resource.webcontainer.jsf.context    : JSF1073: javax.faces.view.facelets.TagException caught during processing of RENDER_RESPONSE 6 : UIComponent-ClientId=, Message=//C:/StockTrends/stock-service/target/classes/META-INF/resources/login.xhtml @38,127 <p:ajax> Event:blabla is not supported.
2019-02-17 11:10:02.471 ERROR 5472 --- [nio-8080-exec-7] j.e.resource.webcontainer.jsf.context    : //C:/StockTrends/stock-service/target/classes/META-INF/resources/login.xhtml @38,127 <p:ajax> Event:blabla is not supported.

javax.faces.view.facelets.TagException: //C:/StockTrends/stock-service/target/classes/META-INF/resources/login.xhtml @38,127 <p:ajax> Event:blabla is not supported.
    at org.primefaces.behavior.base.AbstractBehaviorHandler.applyAttachedObject(AbstractBehaviorHandler.java:184) ~[primefaces-6.2.jar:6.2]
    at org.primefaces.behavior.base.AbstractBehaviorHandler.apply(AbstractBehaviorHandler.java:118) ~[primefaces-6.2.jar:6.2]
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:96) ~[javax.faces-2.3.8.jar:2.3.8]
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:161) ~[javax.faces-2.3.8.jar:2.3.8]

当我使用“ valueChange”发出请求时,eclipse在其控制台中未显示任何活动,并且浏览器在“网络”选项卡中显示了请求(注意-login.jsf是我的主要xhtml页面-只是未重命名)它-尚无实际登录记录)...

但是304的意思是“未修改”-可能是浏览器没有执行任何操作,因为页面正在获得此结果吗?

enter image description here

侧面说明:在启动时,这可能与它有关-我无法弄清楚该异常是关于什么的:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.1.RELEASE)

2019-02-17 11:07:33.738  WARN 5472 --- [           main] o.a.tomcat.util.scan.StandardJarScanner  : Failed to scan [file:/C:/Users/root/.p2/pool/plugins/univocity-parsers-2.5.9.jar] from classloader hierarchy

java.io.FileNotFoundException: C:\Users\root\.p2\pool\plugins\univocity-parsers-2.5.9.jar (The system cannot find the file specified)
    at java.util.zip.ZipFile.open(Native Method) ~[na:1.8.0_141]
    at java.util.zip.ZipFile.<init>(Unknown Source) ~[na:1.8.0_141]
    at java.util.zip.ZipFile.<init>(Unknown Source) ~[na:1.8.0_141]
    at java.util.jar.JarFile.<init>(Unknown Source) ~[na:1.8.0_141]
    at java.util.jar.JarFile.<init>(Unknown Source) ~[na:1.8.0_141]
    at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:164) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
    at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:65) ~[tomcat-embed-core-9.0.13.jar:9.0.13]

1 个答案:

答案 0 :(得分:0)

问题出在我的Company.equals方法中。它没有正确比较符号(使用==代替.equals),并且返回false。