0 Replies Latest reply on Sep 22, 2008 12:58 AM by Chintan Parekh

    A4j:support not working in

    Chintan Parekh Newbie

      Hi,
      we are developing JSF application uses below distribution jars.

      ajax4jsf-1.1.1.jar
      myfaces1.1.5-api.jar
      myfaces1.1.5-impl.jar
      tomahawk1.1.6.jar

      while rending below jsp, we are calling fetchDetail() method of managed bean and setting value in SelectItem. now on selection on radio button we are calling ajaxAction() method of same managed bean and in that case it's not going to ajaxAction() if scope is "request" and if it is "session" then it goes. We have also tried <t:saveState> but that also not worked.

       <t:div id="copay"
       style="width:150px; height:100px; overflow-y: scroll;">
       <t:dataTable id="table2" preserveDataModel="false" border="1"
       value="#{CopayVariation.copayLayerOnelist}" var="variations">
      
       <t:column style="width:25px; padding-left: 3px;">
      
       <%-- onfocus="toggle('variation:body:variationdetails')" --%>
      
       <t:selectOneRadio id="radioLayerOne" forceId="true" forceIdIndex="false"
       value="#{CopayVariation.selectedRow}" >
       <f:selectItem itemValue="#{variations.uniqID}" itemLabel="" id="rad" />
       <a4j:support event="onclick"
       action="#{CopayVariation.ajaxAction}"
       reRender="table2,Variation_Details_Coinsurance_Calculation_Option,Variation_Details_Split_Tablet,Variation_Details_Inclusion_List,sample5"></a4j:support>
       </t:selectOneRadio>
       </t:column>
      
       <t:column style="width:150px; padding-left: 3px;"
       headerstyle="width:60px;">
       <t:selectOneMenu required="true" forceId="true"
       id="Parameter_Variations_Provider"
       value="#{variations.providerTypeCode}"
       disabled="#{variations.enableFlag}">
       <f:selectItem itemLabel=" " itemValue="" />
       <f:selectItems value="#{CopayVariation.providerOptions}">
       </f:selectItems>
       </t:selectOneMenu>
       </t:column>
      
      
       <t:column style="width:100px; padding-left: 3px;"
       headerstyle="width:60px;">
       <h:selectOneMenu required="true"
       id="Parameter_Variations_Network"
       value="#{variations.networkParticipationCode}"
       disabled="#{variations.enableFlag}">
       <f:selectItem itemLabel=" " itemValue="" />
       <f:selectItems value="#{CopayVariation.networkOptions}" />
       </h:selectOneMenu>
       </t:column>
      
       <%-- Claim Type --%>
       <t:column style="width:30px; padding-left: 3px;"
       headerstyle="width:60px;">
       <h:selectOneMenu required="true" id="Parameter_Variations_Claim"
       value="#{variations.claimsTypeCode}"
       disabled="#{variations.enableFlag}">
       <f:selectItem itemLabel=" " itemValue="" />
       <f:selectItems value="#{CopayVariation.claimsOptions}" />
       </h:selectOneMenu>
       </t:column>
      
       <%-- COB Type --%>
       <t:column style="width:60px; padding-left: 3px;"
       headerstyle="width:60px;">
       <h:selectOneMenu required="true" value="#{variations.cobCode}"
       id="Parameter_Variations_COB"
       disabled="#{variations.enableFlag}">
       <f:selectItem itemLabel=" " itemValue="" />
       <f:selectItems value="#{CopayVariation.cobOptions}" />
       </h:selectOneMenu>
       </t:column>
      
       <%-- Formulary Type --%>
       <t:column style="width:85px; padding-left: 3px;"
       headerstyle="width:60px;">
       <h:selectOneMenu required="true"
       id="Parameter_Variations_Formulary"
       value="#{variations.formularyTypeCode}"
       disabled="#{variations.enableFlag}">
       <f:selectItem itemLabel=" " itemValue="" />
       <f:selectItems value="#{CopayVariation.formularyOptions}" />
       </h:selectOneMenu>
       </t:column>
      
       <%-- Tier Type --%>
       <t:column>
       <h:selectOneMenu required="true" value="#{variations.tierCode}"
       id="Parameter_Variations_Tier"
       disabled="#{variations.enableFlag}">
       <f:selectItem itemLabel=" " itemValue="" />
       <f:selectItems value="#{CopayVariation.tierOptions}" />
       </h:selectOneMenu>
       </t:column>
       </t:dataTable>
       </t:div>
      
      



      Inside managed bean we are using following code. In faces-config.xml, scope of this bean is "request". Removed getter/setters purposely.

      
      public class CopayVariation
      {
      
       private CopayService copayService;
      
       private CopayLayerOne copayLayerOne;
      
       private CopayLayerTwo copayLayerTwo;
      
       private CopayLayerThree copayLayerThree;
      
       /* To display list on JSF screen */
      
       private List copayLayerOnelist = new ArrayList( );
      
       private List copayLayerTwoList = new ArrayList( );
      
       private List copayLayerThreeList = new ArrayList( );
      
       /*Lists for dropdown */
       private List providerOptions;
      
       private List networkOptions;
      
       private List formularyOptions;
      
       private List claimsOptions;
      
       private List cobOptions;
      
       private List tierOptions;
      
       private List drugTypeOptions;
      
       private List dawOptions;
      
       private List ccoOptions;
      
       private List inclusionOptions;
      
       private List rejectMessageOptions;
      
       private List copayStepActionOptions;
      
       /**/
       private List providerList = new ArrayList( );
      
       private List networkList = new ArrayList( );
      
       private List claimList = new ArrayList( );
      
       private List cobList = new ArrayList( );
      
       private List formularyList = new ArrayList( );
      
       private List tierList = new ArrayList( );
      
       private List drugTypeList = new ArrayList( );
      
       private List dawTypeList = new ArrayList( );
      
       private List ccoList = new ArrayList( );
      
       private List inclusionList = new ArrayList( );
      
       private VariationList variationList;
      
       private List testList = new ArrayList( );
      
       private String cco;
      
       private int splitTablet;
      
       private String inclList;
      
       private String costDiff = "0";
      
       private boolean booleanCostDiff;
      
       private String drugCost = "0";
      
       private boolean booleanDrugCost;
      
       private double copayPerc = 0.0;
      
       private double maxCopayAmt = 0.0;
      
       private double minCopayAmt = 0.0;
      
       private double copayCost = 0.0;
      
       private double maxPlanCost = 0.0;
      
       private double thirdCopayPerc = 0.0;
      
       private double thirdMaxCopayAmt = 0.0;
      
       private double thirdMinCopayAmt = 0.0;
      
       private double thirdCopayCost = 0.0;
      
       private double thirdMaxPlanCost = 0.0;
      
       private String thirdStepAction;
      
       private List list;
      
       private String checkCon;
      
       CopayLayerOne copayLayerOneSave = new CopayLayerOne( );
      
       CopayLayerTwo copayLayerTwoSave = new CopayLayerTwo( );
      
       CopayLayerThree copayLayerThreeSave = new CopayLayerThree( );
      
       /* To display list on JSF screen */
      
       private String selectedRow;
      
       private String selectedLayerTwoRow;
      
       private String selectedLayerThreeRow;
      
       private Logger logger;
      
       private boolean saveTarget;
      
       /*Variables for unique id of the database*/
      
       private String layerOnemaxId;
      
       private String layerTwomaxId;
      
       private String layerThreemaxId;
      
       private int layerOneId;
      
       private int layerTwoId;
      
       private int layerThreeId;
      
       Session session = null;
      
       /*Lists to be deleted from the database */
      
       private List copayLayerOneDeleteList = new ArrayList( );
      
       private List copayLayerTwoDeleteList = new ArrayList( );
      
       private List copayLayerThreeDeleteList = new ArrayList( );
      
       public CopayVariation( )
       {
       String loggerName = this.getClass( ).getName( );
      
       }
      
      
      
       public String ajaxAction()
       {
       saveTarget = false;
      
       try
       {
      
       copayLayerOneSave.setCoinsuranceCalcOptionCode( getCco( ) );
       copayLayerOneSave.setHalfTabCopayPercent( getSplitTablet( ) );
       copayLayerOneSave.setHalfTabInclusionList( getInclList( ) );
      
       Iterator iterator2 = copayLayerOnelist.iterator( );
       while(iterator2.hasNext( )){
       CopayLayerOne copayLayerOne = ( CopayLayerOne ) iterator2.next( );
       copayLayerOne.setEnableFlag( true );
       }
      
       logger.logText(WAFConstants.DEBUG,"in ajax");
       Iterator iterator = copayLayerOnelist.iterator( );
       while ( iterator.hasNext( ) )
       {
       this.copayLayerOneSave = ( CopayLayerOne ) iterator.next( );
       if ( ( ( String ) getSelectedRow( ) ).equalsIgnoreCase( copayLayerOneSave.getUniqID( ) ) && copayLayerOneSave != null)
       {
       logger.logText(WAFConstants.DEBUG,"unq id " +copayLayerOneSave.getUniqID( ));
       System.out.println("******************id is:" + copayLayerOneSave.getUniqID( ));
       logger.logText(WAFConstants.DEBUG,"selected row" + getSelectedRow( ));
       this.cco = copayLayerOneSave.getCoinsuranceCalcOptionCode( );
       logger.logText(WAFConstants.DEBUG,"cco"+cco);
      
       this.splitTablet = copayLayerOneSave.getHalfTabCopayPercent( );
       logger.logText(WAFConstants.DEBUG,"splitTablet"+splitTablet);
      
       this.inclList = copayLayerOneSave.getHalfTabInclusionList( );
       logger.logText(WAFConstants.DEBUG,"inclList"+inclList);
      
       copayLayerOneSave.setEnableFlag( false );
      
       break;
       }
      
      
       }
      
       /* if ( copayLayerOneSave != null )
       {
      
       }*/
      
       logger.logText(WAFConstants.DEBUG,"b4 target");
       String target = fetchLayerTwo( );
      
       }
       catch ( Exception e )
       {
       logger.logText( WAFConstants.ERROR, "-------Error in ajaxAction()------- !!"
       + e );
       }
      
       return null;
       }
      
      
      
       public String fetchDetails()
       {
       saveTarget = false;
       String target = "failure";
       try
       {
      
      
       ServiceReply serviceReply = null;
       BusinessServiceManager businessServiceManager = WAFServiceFactory.getBusinessServiceManager( );
       ServiceRequest request = WAFComponentFactory.createNewServiceRequest( );
      
       request.setServiceName( BBRWConstants.COPAY_SERVICE_IMPL );
       request.setServiceMethod( BBRWConstants.METHOD_FETCH_COPAY_LAYER_ONE );
      
      
       serviceReply = businessServiceManager.handleRequest( request );
      
      
       String replyStatus = serviceReply.getStatusCode( );
       CopayDetailsResult replyValueObject = ( CopayDetailsResult ) serviceReply.getValueObject( );
       if ( replyStatus.equals( WAFConstants.BSI_STATUS_FAILURE ) )
       {
       if (serviceReply.isHasException( ) )
       {
       BSIException exception = serviceReply.getException( );
       logger.logText( WAFConstants.DEBUG, "BSI Exc " + exception.getExceptionClassName( ) + exception.getExceptionMessage( ) + " StackTrace " + exception.getStackTrace( ));
      
       }
       logger.logText( WAFConstants.ERROR, "------@@@@@@@@@@@@@ - WAFConstants.BSI_STATUS_FAILURE-----" );
       //System.err.println( "@@@@@@@@@@@@@ - WAFConstants.BSI_STATUS_FAILURE" );
       }
       else
       {
      
       providerOptions = replyValueObject.getProviderOptions( );
       networkOptions = replyValueObject.getNetworkOptions( );
       claimsOptions = replyValueObject.getClaimsOptions( );
       cobOptions = replyValueObject.getCobOptions( );
       formularyOptions = replyValueObject.getFormularyOptions( );
       tierOptions = replyValueObject.getTierOptions( );
       drugTypeOptions = replyValueObject.getDrugTypeOptions( );
       dawOptions = replyValueObject.getDawOptions( );
       ccoOptions = replyValueObject.getCcoOptions( );
       inclusionOptions = replyValueObject.getInclusionOptions( );
      
       rejectMessageOptions = replyValueObject.getRejectMessageOptions( );
       copayStepActionOptions = replyValueObject.getCopayStepActionOptions( );
      
       layerOnemaxId = replyValueObject.getMaxIdLayer1( );
       layerTwomaxId = replyValueObject.getMaxIdLayer2( );
       layerThreemaxId = replyValueObject.getMaxIdlayer3( );
      
       logger.logText(WAFConstants.DEBUG, "MAXID1+++++" + layerOnemaxId );
       logger.logText(WAFConstants.DEBUG, "MAXID2+++++" + layerTwomaxId );
       logger.logText(WAFConstants.DEBUG, "MAXID3+++++" + layerThreemaxId );
      
       layerOneId = new Integer( layerOnemaxId ).intValue( );
       layerTwoId = new Integer( layerTwomaxId ).intValue( );
       layerThreeId = new Integer( layerThreemaxId ).intValue( );
      
       copayLayerOnelist = new ArrayList( );
       copayLayerOnelist = replyValueObject.getCopayLayerOneList( );
      
       target = "success";
       logger.logText( WAFConstants.DEBUG, "Target in fetchCopayDetails is :"
       + target );
      
       }
      
       }
       catch ( Exception e )
       {
       logger.logText( WAFConstants.ERROR, "Error in fetchCopayDetails! "
       + e );
       e.printStackTrace( );
       }
       return target;
       }
      
      
      
      
      }
      
      


      One this we noticed that, when we click on radio button, ajax action is going on and it's comes into managedBean constructor. Here we also initialize all SelectItem but that also not worked.

      Our application uses tiles, so does that cause any problem in ajax action?

      We are clueless what could be the cause of this error. Please suggest us as we have already spent much time in resolving it.

      Thanks
      Chintan