thanks you for the reply. I added the code:

    <s:head theme="ajax"/>

on top, plus

<s:submit value="GO2" showLoadingText="false"  theme="ajax" targets="two" />

but I get the same result - it goes to an empty page with the result and not
to the DIV?
:-(

any idea?





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?
> 

-- 
View this message in context: 
http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15579982.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to