我使用jetspeed2开发一个数据通过图表展现的portlet,这个portlet使用fusioncharts进行展现,需要加载几个js文件。 
在一个页面上我需要放置多个图表展现的portlet,所以请教各位有这方面开发经验的前辈们,有没有什么办法,确保页面上的多个portlet中需要的js文件只会加载一次。 
我用了seajs,发现效果不是很好,常常会提示某个函数或对象找不到,估计是js还没加载进来就执行代码了,下面是我的jsp页面代码
<%@ page language="java" pageEncoding="utf-8" %>      
<%@ include file="/common/portlet-taglibs.jsp"%>      
<portlet:defineObjects/>      
<div id="<portlet:namespace/>analysisPanel"></div>      
<script type="text/javascript">      
    seajs.use([      
        '${ctx}/scripts/presentation-chart.js',      
        '${ctx}/scripts/jquery-1.7.1/jquery.min.js',       
        '${ctx}/fc/FusionCharts.js',       
        '${ctx}/fc/FusionCharts.jqueryplugin.js'     
    ], function() {      
        var <portlet:namespace/>condition = {      
            'year': '2011',      
            'month': '1'     
        };      
              
        var analysisPanel = $('#<portlet:namespace/>analysisPanel');      
              
        var param = {};      
        for (var name in <portlet:namespace/>condition) {      
            param['param$' + name] = <portlet:namespace/>condition[name];      
        }      
              
        $.each(${presentationConfigs}, function(index, config) {       
            var id = '<portlet:namespace/>presentation_' + config.code;      
            var div = $('<div id="' + id + '" style="width: ' + config.width + '; height: ' + config.height + 'pt; float: left"></div>');      
                  
            analysisPanel.append(div);      
            config.div = div;      
                  
            var url = '${ctx}/presentation/analysis-presentation!query.action?code=' + config.code + '&type=' + config.type;      
            $.post(url, param, function(result) {      
                div.insertFusionCharts({      
                    swfUrl: '${ctx}/fc/' + chartUrls[config['chart-type']],       
                    dataSource: result,       
                    dataFormat: "xml",       
                    width: div.width() - 2,       
                    height: div.height() - 2,       
                    id: 'chart_' + id,      
                    debugMode: 0     
                });      
            }, 'text');      
        });      
    });      
</script>    我也知道可以在主页面中添加js引用代码,但是这样做了,那我的页面即使在没有使用展现portlet时,也会引入js代码进去,所以我不想这样做。我希望的只是在自己的portlet中去添加js引用