0

Why isn't "symbolChanged" getting called in my managed bean? Also, the graphTitle is not changing either.

<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>

Here's the bean's method:

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

@Kukeltje, I tried other events, like blabla. Those get an error in eclipse (and the page itself). When I try with "change" or "valueChange", eclipse shows nothing in its output.

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]

When I make the request with, say, "valueChange", eclipse shows no activity in its console, and the browser is showing requests in the network tab (note - login.jsf is my main xhtml page - just have not renamed it yet - there's no actual logging in going on)...

But the 304 means "not modified" - could it be that the browser is not doing anything because the page is getting this result?

enter image description here

Side note: on startup, this may have something to do with it - I haven't been able to figure out what this exception is about:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: 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]
Mike
  • 609
  • 12
  • 36
  • 1
    So it effectively behaves as if the `pajax` was not there or the event not supportednAny warning in the logfile? Tried other events? Tried an event called 'blablabla'? – Kukeltje Feb 17 '19 at 16:01
  • Hi Kukeljte, I updated the question with what you asked - the blabla event was not supported - at least we know we've got a valid event with "change" or "valueChange". – Mike Feb 17 '19 at 16:33
  • 1
    Check all in https://stackoverflow.com/questions/2118656/commandbutton-commandlink-ajax-action-listener-method-not-invoked-or-input-value please – Kukeltje Feb 18 '19 at 08:43
  • Thanks kukeltje, lots to look through in that answer, I'll check tonight. – Mike Feb 18 '19 at 13:09

1 Answers1

0

The problem was in my Company.equals method. It wasn't comparing the symbol properly (used == instead of .equals) and was returning false.

Mike
  • 609
  • 12
  • 36