1 Reply Latest reply on Aug 8, 2007 3:44 PM by Eric Jung

    help wtih h:selectOneRadio with a4j:support

    Eric Jung Newbie

      Hi,

      I have the following:

      <h:selectOneRadio id="radio" value="#{bean.searchType}">
       <f:selectItem itemLabel="One"/>
       <f:selectItem itemLabel="Two"/>
       <a4j:support event="onchange" action="#{bean.search}" reRender="pg1"/>
      </h:selectOneRadio>

      By default, "One" is chosen because bean.searchType is "One". But I have two problems:

      1. Ajax call is only done when "Two" is clicked then "One" is clicked. Why isn't Ajax call done when "Two" is clicked alone?

      2. When Ajax call completes, I get this exception:
      2007-08-08 14:50:58,240 DEBUG [org.ajax4jsf.framework.ajax.AjaxRegionBrige] (TP-Processor12:) Restore State of UIAjaxComponent with Id _viewRoot
      2007-08-08 14:50:58,241 DEBUG [org.ajax4jsf.framework.renderer.AjaxPhaseListener] (TP-Processor12:) Process after phase RESTORE_VIEW(1)
      2007-08-08 14:50:58,242 DEBUG [org.ajax4jsf.framework.renderer.AjaxPhaseListener] (TP-Processor12:) Process before phase APPLY_REQUEST_VALUES(2)
      2007-08-08 14:50:58,242 DEBUG [org.ajax4jsf.framework.renderer.RendererBase] (TP-Processor12:) Start decoding of component f1:_idJsp26 with class org.ajax4jsf.ajax.html.HtmlAjaxSupport
      2007-08-08 14:50:58,242 DEBUG [org.ajax4jsf.framework.renderer.AjaxPhaseListener] (TP-Processor12:) Process after phase APPLY_REQUEST_VALUES(2)
      2007-08-08 14:50:58,243 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/pat].[Faces Servlet]] (TP-Processor12:) Servlet.service() for servlet Faces Servlet threw exception
      java.lang.NullPointerException
       at javax.faces.component._SelectItemsIterator.hasNext(_SelectItemsIterator.java:70)
       at javax.faces.component._SelectItemsUtil.matchValue(_SelectItemsUtil.java:46)
       at javax.faces.component.UISelectOne.validateValue(UISelectOne.java:62)
       at org.apache.myfaces.component.html.ext.HtmlSelectOneRadio.validateValue(HtmlSelectOneRadio.java:80)
       at javax.faces.component.UIInput.validate(UIInput.java:353)
       at javax.faces.component.UIInput.processDecodes(UIInput.java:158)
       at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:602)
       at javax.faces.component.UIForm.processDecodes(UIForm.java:53)
       at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:602)
       at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:135)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.access$001(AjaxViewRoot.java:53)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot$1.invokeRoot(AjaxViewRoot.java:254)
       at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:54)
       at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.processDecodes(AjaxViewRoot.java:267)
       at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(LifecycleImpl.java:219)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:97)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at com.novartis.pat.web.PATSessionFilter.doFilter(PATSessionFilter.java:125)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at com.novartis.pat.jboss.security.SetPrincipalServletFilter.doFilter(SetPrincipalServletFilter.java:67)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
       at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
       at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
       at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
       at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:595)
      2007-08-08 14:50:58,246 DEBUG [org.ajax4jsf.framework.renderer.AjaxPhaseListener] (TP-Processor12:) Process before phase RESTORE_VIEW(1)
      2007-08-08 14:50:58,248 DEBUG [org.ajax4jsf.ajax.UIAjaxSupport] (TP-Processor12:) Called setParent for AjaxSupport component with parent : org.apache.myfaces.component.html.ext.HtmlSelectOneRadio


      What's wrong? Thanks for any advice,
      grimholtz