0

我有一个关于 Struts2、Ajax 的问题。

几天前,我在我的项目中添加了一个拦截器,以验证用户在他/她发出请求时是否已登录。后来,我注意到我项目中的大多数请求都被调用了两次。

经过一些调试后,我注意到它可能与我使用的 Ajax 标记(Dojo)有关。

我注意到每次使用 < sx > 标记的 ajax 请求时,该请求都会被调用两次。像这儿:

<s:form action='crear_proyecto'>
        <div><s:textfield id="jefe_proyecto_text" label="Jefe de proyecto"/></div>

        <s:url id="elegir_usuario_url" value="/buscar_usuarios.action">
            ...
        </s:url>

        <sx:bind sources="jefe_proyecto_text" events="onfocus" targets="buscar_usuarios_dialog" href="%{elegir_usuario_url}"/>
        <sx:submit id="crear_proyecto_submit" targets="ventana_mensaje_proyecto" value="Crear proyecto"/>
    </s:form>

有谁知道为什么会这样?

4

1 回答 1

0

Can you check what is your main page header consists ?

like suppose it should have mandatory as <%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

along with this it should have this

<sx:head debug="false" cache="false" compressed="false" parseContent="true" />

parseContent should be 'true' -- if it is false then it will submit record twice it seems.

于 2012-08-31T08:18:40.940 回答