如何在加载 Struts2 <sj:select /> 列表之前对其进行操作?

How to manipulate the list of a Struts2 <sj:select /> before it is loaded?

我已经实现了Struts2-jQuery<sj:select/>

此 select 框被填充以获取来自 AJAX 调用的 JSON 对象。

如何在 javascript 中加载 SelectBox 之前访问此 JSON 对象以便对其进行一些处理?

Struts2-jQuery-plugin's SelectTag 有一个属性:

onBeforeTopic : Topics that are published before a load

用法示例:

<script type="text/javascript">
    $(function(){
        $.subscribe("myBeforeHandler", function(event, data) {
            alert("I'm raised before the loading of the SelectBox ! Data is : " + data);
        });
    });
</script>

<s:url var="myUrl" action="foobar" namespace="/" />

<sj:select onBeforeTopics = "myBeforeHandler"
                     href = "%{myUrl}"
                     list = "foo"
                     name = "bar" />