部分响应错误

时间:2013-04-24 11:23:30

标签: javascript ajax jsf-2 primefaces

我在Facelet中使用此脚本每6秒更新一次值。此Facelet和另一个Facelet包含在同一模板中。

<script type="text/javascript">
    $(document).ready(function(){
        // this is needed to modify request parameters 
        // as PrimeFaces does not transfer the attributes correctly 
        // and does not expose all the parameters as tag attributes
        pushOverview.cfg.request.trackMessageLength = true;
        pushOverview.connect();

        $('a[id*="inetLogo"]').append('<div class="tab_button tab_ine  tlogo"/>');
        loadOverviewCode([{name:'code',value:'#{param['code']}'}]);
        setTimeout(function (){
            checkOverviewTimer('#{param['code']}');
        },6000);
    });

    function checkOverviewTimer(share_code){
        //console.log('checkOverviewTimer for ' + share_code);
        var nameSplit = $('#codeText').text().split(':');
        var codeEmpty = (nameSplit[0] === '');
        var descEmpty = (nameSplit[1] === '');
        var bidEmpty = ($('#'+share_code+'_BID').text() === '');

        if (codeEmpty || descEmpty || bidEmpty){
            //console.log('not all data populated so lets reset a new timer for slightly shorter');
            setTimeout(function (){getOverview([{name: 'code',value:share_code}]);},3000);
        }
    }
</script>

当我在其他代码上搜索任何代码时,我得到了以下ajax响应:

<?xml version='1.0' encoding='UTF-8'?>
<partial-response>
    <error>
        <error-name>class java.lang.IndexOutOfBoundsException</error-name>
        <error-message><![CDATA[Index: 0, Size: 0]]></error-message>
    </error>
</partial-response>

当我从Facelet中删除checkOverviewTimer('#{param['code']}');loadOverviewCode([{name:'code',value:'#{param['code']}'}]);时,它就会开始正常工作。

0 个答案:

没有答案