Your code looks valid, but have you included the <s:head theme="ajax"/> tag in your head section? It looks like the default event is executing (submit form for new page) rather than Dojo using ajax to post it.

Also, as your target is theForm2, add showLoadingText="false" to your submit button. Without that setting, unfortunately, IE writes the loading text over the target (your form) before it's even posted.

xianwinwin wrote:
Hi all,
I'm trying to return a result to DIV in a form (in the example id='two')

this is my form:

<div id='two' style="border: 1px solid yellow;">initial content</div>
<s:form
        id='theForm2'
        cssStyle="border: 1px solid green;"
        action='testing_AjaxRemoteForm'
        method='post'
        theme="ajax">

    <input type='text' name='data' value='Struts User'>

    <s:submit value="GO2" theme="ajax" targets="theForm2"/>

</s:form>

when the user clicks the GO2 --> the action, AjaxRemoteForm,  is 'activated'
(showing the 'data' the user has input)

        public String AjaxRemoteForm()
        {
                System.out.println("active ajax test 1 with data: "+data);
                return "test.ajax.2";
        }

and routed to AjaxResult3.jsp:

        <action name="testing_*"  method="{1}"
class="com.struts.user.account.TestingAction">                     
                        <result name="test.1"                      
type="tiles">test_1</result>
                        <result 
name="test.ajax.2">/pages/welcome/AjaxResult3.jsp</result>
            <interceptor-ref name="user"/>
        </action>



The result comes in a NEW page with the 'data' value the user has input



"AjaxResult3.jsp" -----------------
<%@ taglib prefix="s" uri="/struts-tags" %>

<%
    request.setAttribute("decorator", "none");
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy
server
%>

The value you entered was: <s:property value="data"/><br/>




Q: How can I incorporate the 'data' value in the DIV and not in a new page?

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to