p:ajax抛出方法找不到异常,用p:selectOneRadio

时间:2014-06-22 12:59:22

标签: jsf primefaces

我正在尝试使用p:selectOneRadio>进行Ajax事件,而我正在

 WARNING: Method not found: com.ccc.managedController.TweetDistributionManagedBean@78159a62.renderUploadPanel(javax.faces.event.AjaxBehaviorEvent)
    javax.el.MethodNotFoundException: Method not found: com.ccc.managedController.TweetDistributionManagedBean@78159a62.renderUploadPanel(javax.faces.event.AjaxBehaviorEvent)
        at org.apache.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:245)
        at org.apache.el.parser.AstValue.invoke(AstValue.java:271)
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
        at org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processCustomListener(AjaxBehaviorListenerImpl.java:87)
        at org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processArgListener(AjaxBehaviorListenerImpl.java:72)
        at org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxBehaviorListenerImpl.java:56)
        at javax.faces.event.AjaxBehaviorEvent.processListener(AjaxBehaviorEvent.java:113)
        at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:106)
        at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:760)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:98)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

以下是更多代码

<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
    <p:outputLabel for="selectone" value="Upload :" />
    <p:selectOneRadio id="selectone" 
                      value="#{tweetDistributionManagedBean.tweetType}">
        <f:selectItem itemLabel="Group Tweets" itemValue="GT" />
        <f:selectItem itemLabel="Event Tweets" itemValue="ET" />
        <f:selectItem itemLabel="Suprachar Tweets" itemValue="ST" />

        <p:ajax event="click"
                listener="#{tweetDistributionManagedBean.renderUploadPanel}"
                update="gtid" process="@form" global="false" />
    </p:selectOneRadio>
</h:panelGrid>

和Java bean方法

public void renderUploadPanel(final SelectEvent event) {
    String selecteValues = (String) event.getObject();
    visibleGTFlag = true;
}

2 个答案:

答案 0 :(得分:2)

试试这个

public void renderUploadPanel(AjaxBehaviorEvent event) {
    System.out.println(tweetType);
    visibleGTFlag = true;
}

答案 1 :(得分:-1)

您可以尝试使用事件“ ValueChangeEvent”,请看我的示例:

public void renderUploadPanel(ValueChangeEvent event) {
    String selecteValues = event.getNewValue().toString();
    visibleGTFlag = true;
}