如何使用dojo.event.topic.publish在请求中传递参数

时间:2014-04-02 13:20:51

标签: java ajax struts2 dojo

我会在Dojo Ajax调用生成的http请求中发送参数:dojo.event.topic.publish

实际上,当我拦截http请求时,我有:

  • http://<my_host>:8080/myApplication/myAction.do?dojo.preventCache=1396444095140

并希望:

  • http://<my_host>:8080/myApplication/myAction.do?dojo.preventCache=1396444095140&param=myParam

JSP文件:

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

<script language="javascript">
    function refreshQuestions(element) {
        var td = element.parentNode;
        document.getElementsByName('codeScoringFamille').value = td.getAttribute('id');
        dojo.event.topic.publish("/listQuestionTopic", "0", "1");
    }
</script>

<table class="scoreBoard" width="100%">
    <tr class="titre">
        <td class="familletitre" width="30%" height="32"><s:property
                value="getText('resultat.sous_famille.question.label')" /></td>

        <s:if test="%{currentUser.collaborateur.displayWeight}">
            <td class="familletitre" width="30%" height="32"><s:property
                    value="getText('question.weight.label')" /></td>
        </s:if>
    </tr>
    <s:if test="%{resultatsSousFamilleItem.size != 0}">
        <s:iterator value="resultatsSousFamilleItem" status="rowstatus">
            <s:if test="#rowstatus.odd == true">
                <s:set name="trClass" value="%{'even'}"></s:set>
            </s:if>
            <s:else>
                <s:set name="trClass" value="%{'odd'}"></s:set>
            </s:else>
            <tr class="<s:property value="#trClass"/>">
                <td id="<s:property value="%{idResultatScoring}" />_<s:property value="%{idFamille}" />_<s:property value="%{idResultatScoring}" />" 
                class="famille_<s:property value="#trClass"/>"><s:a href=""
                        cssClass="scoreBoard" onclick="refreshQuestions(this)">
                        <s:property value="%{getText(codeTraduction)}" />


                    </s:a></td>

                <s:if test="%{currentUser.collaborateur.displayWeight}">
                    <td class="famille_<s:property value="#trClass"/>"><s:property
                            value="%{weight}" /></td>
                </s:if>
            </tr>
        </s:iterator>
    </s:if>
</table>

<sx:div id="listQuestion" href="displayQuestion.do" formId="idFormQuestion"
    listenTopics="/listQuestionTopic" theme="ajax" preload="false">
    <s:param name="codeScoringFamille" value="codeScoringFamille"></s:param>
</sx:div>

0 个答案:

没有答案